指向特定定制者部分的链接

时间:2016-01-13 作者:frogg3862

我有一个网站有一些额外的定制部分。有没有办法直接链接到这些so that section open when the page loads?

类似于http://mysites.com/wp-admin/customize.php#fonts

screenshot http://new.tinygrab.com/96412a96d208cf8ff0cf5803327b2d29e0ca68810e.png

1 个回复
最合适的回答,由SO网友:Sven 整理而成

正如您已经发现的,指向自定义程序的链接总是以/wp-admin/customize.php.

追加?autofocus[section] =section_name 在自定义程序中签出分区。两个参数(sectionsection_name) 在您的customize_register 挂钩:

$wp_customize->add_section
如果找不到挂钩,请检查定制程序的HTML标记以获取更多信息。这两个参数都包含在列表中:

<li id="accordion-section-title_tagline" class="accordion-section control-section control-section-default">
总之,您的链接可能如下所示:

admin_url( \'/customize.php?autofocus[section]=section_name\' );
以下是指向二十个WordPress主题中默认自定义程序部分的链接:

站点标识:/customize.php?autofocus[section]=title_tagline/customize.php?autofocus[section]=colors/customize.php?autofocus[section]=options/customize.php?autofocus[section]=cover_template_options/customize.php?autofocus[section]=background_image/customize.php?autofocus[panel]=nav_menus/customize.php?autofocus[panel]=widgets/customize.php?autofocus[section]=static_front_page/customize.php?autofocus[section]=custom_css


Where to go from this?

我经常发现自己需要WordPress管理菜单中的外观菜单项。所以,也许这对你也有帮助:

add_action( \'admin_menu\', \'wpse_custom_submenu_page\' );
function wpse_custom_submenu_page() {
  add_submenu_page(
    \'themes.php\',
        __( \'Page title\', \'textdomain\' ),
        __( \'Menu title\', \'textdomain\' ),
        \'manage_options\',
        \'/customize.php?autofocus[section]=section_name\'
    );
}

相关推荐

在将代码添加到函数后无法登录WordPress wp-admin。php

我在函数末尾添加以下代码。php文件,用于根据自定义帖子的帖子标题填充分类法。问题是,当我添加代码时,尝试登录wp admin时会出现以下错误。非常感谢您能帮助我们弄清楚为什么会发生这种情况。Error:错误:由于意外输出,Cookie被阻止。有关帮助,请参阅此文档或尝试支持论坛。Code: <?php function update_custom_terms($post_id) { // only update terms if