我正试图为我的主题制作一些自定义程序,但我遇到了JS错误“UncaughtReferenceError:wp is not defined”LOL。我写的所有代码都是基于Codex的,也许这只是wp 3.8的bug?或者我做错了什么?
我的代码-PHP:
add_action( \'customize_preview_init\', \'customizer_preview\' );
function customizer_preview() {
wp_register_script( \'wproto-customizer-preview\', get_template_directory_uri() . \'/js/admin/screen-customizer.js\', \'\', true );
wp_enqueue_script( \'wproto-customizer-preview\', array( \'jquery\', \'customize-preview\' ) );
}
JS公司:( function( $ ) {
// here i\'ve got an error "wp is not defined"
wp.customize( \'blogname\', function( value ) {
value.bind( function( newval ) {
$( \'#text-logo .site-title\' ).html( newval );
} );
} );
} )( jQuery );
请帮助:)