How to remove the Theme Customization Button from the dashboard and themes options page?

With the lastest version of WordPress (4.3) you can now natively remove the customizer’s theme switch setting without resorting to CSS hacks. /** * Remove customizer options. * * @since 1.0.0 * @param object $wp_customize */ function ja_remove_customizer_options( $wp_customize ) { //$wp_customize->remove_section( ‘static_front_page’ ); //$wp_customize->remove_section( ‘title_tagline’ ); //$wp_customize->remove_section( ‘nav’ ); $wp_customize->remove_section( ‘themes’ ); } add_action( … Read more

Use default value of wp_customizer in theme_mod output?

Sadly not – all your customize controls are hooked onto customize_register, so they’ll only ever come into play when customising the theme for the first time. get_theme_mod() takes a second argument for a “default” value – yes, it means two instances of data in your code, but it’s a half-solution. I guess a more DRY … Read more

Adding a description to theme customizer controls

Here is one way to do it by extending the control you want to use. Below is an example where we extend the text control and add an extra description like the one seen here on the screenshot: function mytheme_customizer( $wp_customize ) { class Custom_Text_Control extends WP_Customize_Control { public $type=”customtext”; public $extra=””; // we add … Read more

Can a widget in the Customizer be “single-use” (i.e. disabled after 1 instance has been added)?

Approach So I’ve looked into this and my approach is this: When launching the customizer go through all sidebars and disable the widget as soon as you find any usage of it Whenever a sidebar is changed do that again. Disclaimer This has the following limitations: This is the first time I’ve dabbled in playing … Read more

How to create a theme customizer ‘sub’ panel?

You create Panels, and put Sections inside those Panels. So if you have your panel: $wp_customize->add_panel( ‘panel_id’, array( ‘priority’ => 10, ‘capability’ => ‘edit_theme_options’, ‘theme_supports’ => ”, ‘title’ => __(‘Theme Options’, ‘mytheme’), ‘description’ => __(‘Several settings pertaining my theme’, ‘mytheme’), ) ); Then you need to add your sections: $wp_customize->add_section( ‘header_settings’, array( ‘priority’ => 10, … Read more

Is it Possible to Extend WP Customize JS Methods?

I will enhance my small comment on your question. But again the hint; I’m not a JS expert. The follow source, hints was only used on playing with the Customizer for different checks, examples, like my sandbox. wp.customize Understanding the WP theme customizer interface centers around understanding the wp.customize javascript object. The wp.customize object is … Read more

Get entered value of customiser field for live preview

Yes. wp.customize( ‘header_textcolor’ )(): ( function( $ ) { //Update site background color… wp.customize( ‘background_color’, function( value ) { value.bind( function( newval ) { $(‘body’).css(‘background-color’, newval ); var text_colour = wp.customize( ‘header_textcolor’ )(); // … now do something with text_colour } ); } ); } )( jQuery );

Custom Image section in Customizer

So I did some research on the matter and I found a solution. Basically WordPress has this cool feature where you can call something called get_theme_mod so what I essentially did was add get_theme_mod inside my <img> src. So this is what I changed my <img> tag to after finding out about get_theme_mod: <img src=”https://wordpress.stackexchange.com/questions/215701/<?php … Read more