如果你看看这部分的源代码…
do_action( \'customize_controls_print_styles\' );
do_action( \'customize_controls_print_scripts\' );
?>
</head>
<body class="<?php echo esc_attr( $body_class ); ?>">
<div class="wp-full-overlay expanded">
<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
<div id="customize-header-actions" class="wp-full-overlay-header">
<?php
$save_text = $wp_customize->is_theme_active() ? __( \'Save & Publish\' ) : __( \'Save & Activate\' );
submit_button( $save_text, \'primary save\', \'save\', false );
?>
<span class="spinner"></span>
<a class="back button" href="<?php echo esc_url( $return ? $return : admin_url( \'themes.php\' ) ); ?>">
<?php _e( \'Cancel\' ); ?>
</a>
</div>
…你可以看到这个地方没有任何行动。
但你可以customize_controls_print_scripts
并注册一个插入按钮的新JavaScript。
add_action( \'customize_controls_print_scripts\', \'add_customizer_button\' );
function add_customizer_button()
{
wp_register_script( \'my_customizer_script\', plugins_url(\'/customizer_button.js\', __FILE__) );
wp_enqueue_script( \'my_customizer_script\' );
}