我查看了文档和应该如何完成这个示例,但无法看到下面的代码是什么问题。我的孩子主题中的功能只是没有被调用。这也可能是有目共睹,但我就是不能看到它,看到最欢迎任何指针...WordPress的应用过滤器/从儿童主题添加过滤器
父主题的functions.php的
add_action('init', 'st_header_scripts');
function st_header_scripts() {
$javascripts = wp_enqueue_script('jquery');
$javascripts .= wp_enqueue_script('custom',get_bloginfo('template_url') ."/javascripts/app.js",array('jquery'),'1.2.3',true);
$javascripts .= wp_enqueue_script('superfish',get_bloginfo('template_url') ."/javascripts/superfish.js",array('jquery'),'1.2.3',true);
$javascripts .= wp_enqueue_script('formalize',get_bloginfo('template_url') ."/javascripts/jquery.formalize.min.js",array('jquery'),'1.2.3',true);
echo apply_filters ('child_add_javascripts',$javascripts);
}
儿童主题
...
function child_add_javascripts($javascripts) {
$javascripts = "test";
echo "test"; die;
return $javascripts;
}
add_filter('st_header_scripts','child_add_javascripts');