wordpress customize.php,从wordpress插件覆盖$wp_customize
发布日期:2021-08-20 00:42:48 浏览次数:7 分类:技术文章

本文共 1168 字,大约阅读时间需要 3 分钟。

我在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

转载地址:https://blog.csdn.net/weixin_31856057/article/details/115635846 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:java当输入一个数字就进行加一操作,Java第二次作业 - osc_zm0p03yr的个人空间 - OSCHINA - 中文开源技术交流社区...
下一篇:linux apache2.4 php,linux + apache 2.4.4 + php配置

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2025年01月01日 06时39分04秒