How to check WP Customize Control

I’m not sure what exactly you’re trying to accomplish, but if you’re wanting to manipulate customizer controls until the customize_register action has fired. So do something like this: add_action( ‘customize_register’, function( $wp_customize ) { $control = $wp_customize->get_control( ‘header_text’ ); if ( $control ) { error_log( ‘header_text control exists’ ); } else { error_log( ‘header_text control … Read more

How to display specific title on Customizer?

You can create a Custom Control for WP Customizer and use it. For example: class Sub_Section_Heading_Custom_Control extends WP_Customize_Control { //The type of control being rendered public $type=”sub_section_heading”; //Render the control in the customizer public function render_content() { ?> <div class=”sub-section-heading-control”> <?php if( !empty( $this->label ) ) { ?> <h4 class=”customize-control-title”> <?php echo esc_html( $this->label ); … Read more

Customizer sanitize_callback for input type number

Add a setting, specifying the sanitize_callback: $wp_customize->add_setting( ‘my_input’, array( ‘default’ => ‘100.00’, ‘sanitize_callback’ => ‘sanitize_float’, ) ); Add the control: $wp_customize->add_control( ‘my_input’, array( ‘label’ => ‘Please enter a number:’, ‘section’ => ‘my_section’, ‘type’ => ‘number’, ‘input_attrs’ => array( ‘min’ => ‘0.01’, ‘step’ => ‘0.01’, ‘max’ => ‘10000’, ), ) ); Create a function to perform … Read more

default custom background image not saved in database when creating a new site

I assume you mean “get_theme_mod(‘background_image’) returns false” before I “save it once to activate it” If that is the case, get_theme_mod accepts a default parameter. Check the Codex: $name (string) (required) Theme modification name. Default: None $default (boolean|string) (optional) Default: false Pass your default image as the second parameter to that function and you should … Read more

WP Theme Customizer – Responsive Elements

You could output large image inside an inline @media block assuming you are talking about window width and not literally screen width. Also providing a default if neither option is set so first if statement is not required. .thumbnail {width: <? php echo get_option(‘thumbnail_size_medium’) ?: $default_size; ?>;} <?php if( get_option(‘thumbnail_size_large’) ) { ?>@media ( min-width: … Read more