Customizer Ajax

This is the JavaScript code used in the underscores theme to preview any change of the setting value without reloading the previewer:

// Site title and description.
wp.customize( 'blogname', function( value ) {
    value.bind( function( to ) {
        $( '.site-title a' ).text( to );
    } );
} );

Instead of using this (from the code above):

    value.bind( function( to ) {
        $( '.site-title a' ).text( to );
    } );

Can I use the following?

    function ( value ) {
        $( '.site-title a' ).text( value );
    }

Topic underscore theme-customizer Wordpress

Category Web


In short - yes you can. Whether it's a smart thing to do depends on your demands. If you want to use the functionality for customization of a theme you can read about the API here.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.