在主题的shortcodes.php中添加短代码会导致错误

时间:2015-03-18 20:14:37

标签: wordpress

我在主题的shortcodes.php中添加了以下代码:

if (!function_exists('testlist')) {
    function testlist($atts, $content = null) {
        $args = shortcode_atts(array("list"=>""), $atts);
        return "Here's a test to see if the function is called.";
    }
}
add_shortcode('testlist', 'testlist');

当我调用短代码(在编辑器中键入[testlist])时,会发生以下错误:

Warning: Invalid argument supplied for foreach() in /var/www/html/wp-content/plugins/js_composer/include/classes/core/class-vc-base.php on line 345

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/js_composer/include/classes/core/class-vc-base.php:345) in /var/www/html/wp-includes/pluggable.php on line 1178

0 个答案:

没有答案