我有一个wordpress主题,我通过制作一个儿童主题来修改外观和感觉。
我使用的父主题使用redux框架。
我对使用过滤器和挂钩有点陌生,但我想在选项页面上添加/修改一个部分。
我找到了一个通过子主题添加节的函数,但我不知道如何使用它。
当我在子主题函数中包含代码时。php我收到一个错误,说它不能被重新定义。
这是选项中显示的示例。php文件。
有谁能帮我解释一下如何使用这个函数,或者给我一些关于如何使用它的简明解释。
谢谢
/*
*
* Custom function for filtering the sections array. Good for child themes to override or add to the sections.
* Simply include this function in the child themes functions.php file.
*
* NOTE: the defined constansts for URLs, and directories will NOT be available at this point in a child theme,
* so you must use get_template_directory_uri() if you want to use any of the built in icons
*
*/
function add_another_section($sections){
//$sections = array();
$sections[] = array(
\'title\' => __(\'A Section added by hook\', AZ_THEME_NAME),
\'desc\' => __(\'<p class="description">This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.</p>\', AZ_THEME_NAME),
\'icon\' => \'paper-clip\',
\'icon_class\' => \'icon-large\',
// Leave this as a blank section, no options just some intro text set above.
\'fields\' => array()
);
return $sections;
}
//add_filter(\'redux-opts-sections-twenty_eleven\', \'add_another_section\');