php 如何链接到WordPress定制器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 如何链接到WordPress定制器相关的知识,希望对你有一定的参考价值。
/**
* How to link into the WordPress Customizer
*/
Simple Link:
<a href="<?php echo esc_url( admin_url( 'customize.php' ) ); ?>">Link to Customizer</a>
Link to Panel:
$query['autofocus[panel]'] = 'nav_menus';
$panel_link = add_query_arg( $query, admin_url( 'customize.php' ) );
?><a href="<?php echo esc_url( $panel_link ); ?>">Link to Panel</a>
Link to section:
$query['autofocus[section]'] = 'title_tagline';
$section_link = add_query_arg( $query, admin_url( 'customize.php' ) );
?><a href="<?php echo esc_url( $section_link ); ?>">Link to Section</a>
Link to control (field)
$query['autofocus[control]'] = 'blogname';
$control_link = add_query_arg( $query, admin_url( 'customize.php' ) );
?><a href="<?php echo esc_url( $control_link ); ?>">Link to Control</a>
Return somewhere else after the Customizer:
$query['return'] = admin_url();
$link_with_return = add_query_arg( $query, admin_url( 'customize.php' ) );
Link to control, the return to another page:
$query['autofocus[control]'] = 'blogname';
$query['return'] = admin_url( 'post-new.php' );
$link = add_query_arg( $query, admin_url( 'customize.php' ) );
?><a href="<?php echo esc_url( $link ); ?>">Set title, then write post</a>
Set Preview page:
$query['url'] = site_url( '/news' );
$link = add_query_arg( $query, admin_url( 'customize.php' ) );
?><a href="<?php echo esc_url( $link ); ?>">News Page in Preview</a>
All together:
$query['autofocus[section]'] = 'menu_locations';
$query['return'] = admin_url( 'post-new.php?post_type=page' );
$query['url'] = site_url( '/about-us' );
$link = add_query_arg( $query, admin_url( 'customize.php' ) );
?><a href="<?php echo esc_url( $link ); ?>">Craziness!</a>
以上是关于php 如何链接到WordPress定制器的主要内容,如果未能解决你的问题,请参考以下文章
php 如何链接到WordPress定制器
php WordPress定制器
php 破碎(或空白)wordpress定制器解决方案
php 扩展WordPress定制器面板和部分以允许嵌套
如何从 API 调用附加到 WordPress 定制器中的选择框?
wordpress 主题定制器下拉菜单