admin管理员组文章数量:1388859
I've got a site with a few extra Customizer sections. Is there a way to link directly to these so that section open when the page loads?
Something like .php#fonts
screenshot .png
I've got a site with a few extra Customizer sections. Is there a way to link directly to these so that section open when the page loads?
Something like http://mysites/wp-admin/customize.php#fonts
screenshot http://new.tinygrab/96412a96d208cf8ff0cf5803327b2d29e0ca68810e.png
Share Improve this question asked Jan 13, 2016 at 16:47 frogg3862frogg3862 4303 silver badges10 bronze badges1 Answer
Reset to default 34As you've already discovered, links to the customizer always start with /wp-admin/customize.php
.
Append ?autofocus[
section
] =
section_name
to checkout your section within the customizer. Both parameters (section
and section_name
) are registered within your customize_register
hook:
$wp_customize->add_section
If you can't find the hook, check the HTML markup of the customizer for further information. Both parameters are included within the list:
<li id="accordion-section-title_tagline" class="accordion-section control-section control-section-default">
Altogether your link may look something like this:
admin_url( '/customize.php?autofocus[section]=section_name' );
These are the links to the default customizer sections in Twenty Twenty WordPress theme:
- Site Identity:
/customize.php?autofocus[section]=title_tagline
- Colors:
/customize.php?autofocus[section]=colors
- Theme Options:
/customize.php?autofocus[section]=options
- Cover Template:
/customize.php?autofocus[section]=cover_template_options
- Background Image:
/customize.php?autofocus[section]=background_image
- Menus:
/customize.php?autofocus[panel]=nav_menus
- Widgets:
/customize.php?autofocus[panel]=widgets
- Homepage Settings:
/customize.php?autofocus[section]=static_front_page
- Additional CSS:
/customize.php?autofocus[section]=custom_css
Where to go from this?
I often find myself in need of a menu item from Appearance within the WordPress admin menu. So maybe this will be helpful for you, too:
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'
);
}
本文标签: themesLink to specific Customizer section
版权声明:本文标题:themes - Link to specific Customizer section 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744606519a2615388.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论