Domanda

Am making a custom theme, and in the Theme Customizer, will it be possible to change that checkbox under Site Title to something like "Display Site Title instead of Logo"?

(i have removed that tagline field and added an image upload field for Logo)

or, remove that checkbox from there? which one is easier?

thanks!

È stato utile?

Soluzione

You will need to de-register that control. It will look like this:

/**
 * Remove parts of the Options menu we don't use.
 *
 * @param WP_Customize_Manager $wp_customize Customizer manager.
 */
function de_register( $wp_customize ) {
    $wp_customize->remove_control('display_header_text');
}
add_action( 'customize_register', 'de_register', 11 );

For more information, this Theme Customization is a good start.

Altri suggerimenti

@flummox's answer is on point; existing settings can be removed, moved and altered. Expanding upon Flummox's example.

/**
     * Modify existing / default customizer settings.
     *
     * @param WP_Customize_Manager $wp_customize Customizer manager.
     */


    function my_update_header_text( $wp_customize ) {
                // remove
                $wp_customize -> remove_section('display_header_text');
                // move <-- must remove control first to move the control
                $wp_customize -> get_control('display_header_text') -> section = 'my_theme_options[header]';
                // change label/description
                $wp_customize -> get_control('display_header_text') -> label = __('Display Header Text');
                // change display order
                $wp_customize -> get_control('display_header_text') -> priority = 10;  
  }
    add_action( 'customize_register', 'my_update_header_text', 11 );
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top