【发布时间】:2015-03-11 23:06:30
【问题描述】:
我需要将过滤器添加到特定的 wordpress 函数,该函数在可插入函数主题的函数 f 包含的文件中定义
functions.php:
if (!function_exists('nectar_colors_css_output')) {
function nectar_colors_css_output(){
include('css/colors.php');
}
}
colors.php:
<?php
function nectar_colors() {
// not relevant what happens here, but I have
// to call another function before this one is called!
}
?>
我使用一个子主题,当我尝试从子主题的functions.php 中过滤这个函数时,没有任何反应。这是因为父主题的可插入函数将在从子主题调用过滤器之后调用。
我在子主题的functions.php中的过滤功能是
function filter_function() {
// some custom actions...
}
add_filter('nectar_colors', 'filter_function');
我怎样才能让这个过滤器工作?
【问题讨论】:
标签: wordpress function filter themes pluggable