wordpress customize.php,从wordpress插件覆盖$wp_customize

我在WordPress中使用了一个简单的主题, 该主题从插件ThemeHunk Customizer中拉出了定制器部分。

我想在定制器部分中隐藏某些部分, 但是在使用$ wp_customize时, 它不起作用。

这是我要隐藏的内容:

$wp_customize->add_section('section_home_ordering', array(

'title' => __('Section Ordering', 'featuredlite'), 'priority' => 3, ));

该文件位于/wp-content/plugins/themehunk-customizer/featuredlite/customizer/customizer.php文件中。

我已经将此添加到我的子主题目录中的我的functions.php文件中:

function customize_register_init( $wp_customize ){

$wp_customize->remove_section('section_default_home');

$wp_customize->remove_section('pro_button');

$wp_customize->remove_section('Docs_button');

$wp_customize->remove_section('section_home_ordering'); - THIS IS THE SECTION I would like removed from the /plugin/ file

}

add_action( 'customize_register', 'customize_register_init', 99 );

不过, 它似乎并未删除, 就像你要从父主题中删除某个部分时一样。

还有另一种方法可以做到这一点, 还是不能从插件而不是父主题中删除?

先感谢你。

解决了我使用customize_controls_enqueue_scripts钩子在wordpress定制器中输入定制CSS的功能, 因此我可以将某些元素显示为隐藏!

#1

在主题中, 你的代码可以正常工作。也许这取决于动作挂钩的顺序。你有没有尝试过?

add_action( 'plugins_loaded', 'customize_register_init', 99 );

#2

你可以直接使用这些说明文件, 因为它显示可以禁用主页(FrontPage)的特定部分。你也可以从”外观”>”首页”>”节顺序”来更改外观的顺序。

参考链接:https://themehunk.com/docs/shopline-theme/#frontpage-section

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值