【问题标题】:How to add/Modify Redux Framework options in Child Theme如何在子主题中添加/修改 Redux 框架选项
【发布时间】:2019-03-18 23:59:25
【问题描述】:

我正在使用使用 Redux Framework 的付费主题。我正在尝试在页脚选项中添加一个新字段。我可以在选项中添加此字段,但仅在 print_r() 函数中显示未显示在主题选项面板中。

function add_another_section_bl($sections){

$sections[12]['fields'][] = array(
    'id'        => 'rd_footer_message_1',
    'type'      => 'textarea',
    'title'     => __('Text 2 to display in footer under bar', 'thefoxwp'),
    'subtitle'  => __('write your copyright information or anything you\'d like.', 'thefoxwp'),
    'validate'  => 'html', //see http://codex.wordpress.org/Function_Reference/wp_kses_post
    'default'   => 'Copyright 2015 <a href="http://themeforest.net/user/tranmautritam?ref=tranmautritam" target="_blank">Tranmautritam\'s team</a>   |   All Rights Reserved'
);
return $sections;}

add_filter("redux/options/rd_data/register", 'add_another_section_bl');

在数组数据中,它显示所需的数据,但不在 wordpress 仪表板的选项面板中。

请让我摆脱这一切。

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    如果您使用 Redux API,有一个更简单的方法: https://docs.redux.io/configuration/redux-api.html

    您可以在呈现之前修改、添加、更新任何部分或字段。请注意,您可能必须将代码放入钩子中。另请注意,Redux 4 方法名称已从 setArgs 更改为 set_args(驼峰式改为非)。

    否则,您将拥有所需的一切。

    【讨论】:

    • 非常感谢您的回复。我应该覆盖子主题中的所有选项还是只需要在选项中添加?
    • 还有一件事要知道,我怎样才能在 Redux:: 的子主题中获得参考
    • 我试过这个,但在 Child Theme 中不起作用:if ( ! class_exists( 'Redux' ) ) { return; } $opt_name = 'rd_data'; $args = Array( 'opt_name' =&gt; $opt_name, 'customizer' =&gt; true ); Redux::set_args ( $opt_name, $args ); $args = Redux::get_args( $opt_name ); print_r($args); echo Redux::get_arg( $opt_name, 'opt_name' );
    • 我已经收录了这个require_once get_template_directory() . '/admin/redux-framework/inc/class.redux_api.php';
    • 在包含这个之后,我称之为:$section = Redux::getSection( 'rd_data', 'general-settings' ); 这在print_r($section); 中没有显示任何黑页
    猜你喜欢
    • 2015-03-04
    • 2015-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-14
    • 1970-01-01
    • 1970-01-01
    • 2015-08-16
    相关资源
    最近更新 更多