创建自定义项。js文件,并将以下脚本放入自定义程序中。js文件
(function( $ ) {
"use strict";
wp.customize( \'tcx_link_color\', function( value ) {
value.bind( function( to ) {
$( \'a\' ).css( \'color\', to );
} );
});
})( jQuery );
并将自定义程序排队。在自定义程序中使用wp\\u enqueue\\u脚本创建js文件。像这样的php文件
function tcx_customizer_script() {
wp_enqueue_script(
\'tcx-customizer\',
get_template_directory_uri() . \'/js/customizer.js\',
array( \'jquery\', \'customize-preview\' ),
\'0.3.0\',
true
);
}
add_action( \'customize_preview_init\', \'tcx_customizer_script\' );
那就好了