问题描述
我的主题不使用标签行,我该如何从自定义程序中删除?
最佳解决方案
晚会到晚会,但这样做的诀窍在于:
$wp_customize->remove_control('blogdescription');
你想删除只是那个控件,而不是整个部分,如上所述。
次佳解决方案
使用此代码在 wordpress 主题中删除预先定制的设置。
add_action( "customize_register", "ruth_sherman_theme_customize_register" );
function ruth_sherman_theme_customize_register( $wp_customize ) {
//=============================================================
// Remove header image and widgets option from theme customizer
//=============================================================
$wp_customize->remove_control("header_image");
$wp_customize->remove_panel("widgets");
//=============================================================
// Remove Colors, Background image, and Static front page
// option from theme customizer
//=============================================================
$wp_customize->remove_section("colors");
$wp_customize->remove_section("background_image");
$wp_customize->remove_section("static_front_page");
}
第三种解决方案
我发现 WP_Customize_Manager 类有一个名为 remove_section()
的函数。在你的功能挂钩到 customize_register
你可以做:
$wp_customize->remove_section('nav');
$wp_customize->remove_section('static_front_page');
如果您检查该部分的手风琴标题栏,您可以找到该部分的 ID(即’nav’) 。看看含有<li>
标签的 ID,它是"customize-section-"
之后的字符串部分。即:
<li id="customize-section-static_front_page" class="control-section customize-section">
– ID 为"static_front_page"
参考文献
注:本文内容整合自 Google/Baidu/Bing 辅助翻译的英文资料结果。如果您对结果不满意,可以加入我们改善翻译效果:薇晓朵技术论坛。