我已经为我的WordPress主题创建了一个自定义部分,但是,无论何时打印该部分,都会添加内联样式以隐藏该部分。以下是部分声明,自定义部分注册及其用法:
<li id="accordion-section-theme_test_data" class="accordion-section control-section control-section-theme_test_data" aria-owns="sub-accordion-section-theme_test_data" style="display: none;">
<form method="POST" action="{hiddenforprivacy}">
<input name="testdatainstall" value="1" type="hidden">
<input id="_wpnonce" name="_wpnonce" value="24923e18ae" type="hidden"><input name="_wp_http_referer" value="/wp/wp-admin/customize.php?return=%2Fwp%2Fwp-admin%2Fedit.php" type="hidden">
<h3 class="accordion-section-title">
<span>Install our test data</span>
<button type="submit" class="theme_customizer_doc_button btn">Install</button>
</h3>
</form>
</li>
然而,在HTML输出中,它呈现如下:
Promise.all
你有什么线索吗?我尝试了所有:(
答案 0 :(得分:1)
WordPress部分由HTML结构和JavaScript部分组成。我没有通过JavaScript将该部分设置为始终处于活动状态。我做了如下:
api.sectionConstructor['theme_test_data'] = api.Section.extend( {
// No events for this type of section.
attachEvents: function () {},
// Always make the section active.
isContextuallyActive: function () {
return true;
}
} );