Add/remove controls dynamically based on other settings in Customizer

Ok so you can check out my repo with some custom controls https://github.com/dingo-d/wordpress-theme-customizer-extra-custom-controls I’ve adapted the contextual controls by Weston Ruters guide here: https://make.xwp.co/2016/07/24/dependently-contextual-customizer-controls/ In my example in the repo I have the boxed body checkbox control that toggles boxed body. You’ll need to enqueue a script to put the js code in add_action( ‘customize_controls_enqueue_scripts’, … Read more

How to print the value of a custom control in the Customizer?

Your code is perfect just need to change ‘theme_mod’ instead of ‘option’ it will solve this. function themename_customize_register($wp_customize){ $wp_customize->add_setting( ‘test_setting’, array( ‘default’ => ‘value_xyz’, ‘capability’ => ‘edit_theme_options’, ‘type’ => ‘theme_mod’, )); $wp_customize->add_control( ‘test_control’, array( ‘label’ => __(‘Text Test’, ‘themename’), ‘section’ => ‘spacious_slider_number_section1’, ‘settings’ => ‘test_setting’, )); } add_action(‘customize_register’, ‘themename_customize_register’); And to retrieve it get_theme_mod( ‘test_setting’ … Read more

Custom editable content for front page from Theme Customizer

It’s an interesting thought to use the theme customizer to completely build the front page. Here is how I would start it. First, let’s build a section that only shows on the front-page: add_action( ‘customize_register’, ‘wpse_205445_customizer’ ); function wpse_205445_customizer($wp_customize) { $wp_customize->add_section( ‘custom-front-page’, array( ‘title’ => “Custom Front Page”, ‘priority’ => 10, ‘active_callback’ => ‘is_front_page’ )); … Read more

Is there any way to add placeholder for WordPress Customizer text input fields

You can use the input_attrs argument to pass attributes to the input: $wp_customize->add_control(‘directorist_address’, array( ‘label’ => __(‘Address’, ‘directorist’), ‘section’ => ‘directorist_contact’, ‘settings’ => ‘directorist_address’, ‘description’ => __(‘Enter your contact address. Eg. Abc Business Center, 123 Road, London, England’, ‘directorist’ ), ‘input_attrs’ => array( ‘placeholder’ => __( ‘Placeholder goes here…’, ‘directorist’ ), ) ) );

Different customizer previewUrls per section

You could use active_callback property to delegate section visibility depending on current preview screen. $wp_customize->add_section( ‘my-section’, array( ‘title’ => __( ‘Section Title’ ), ‘active_callback’ => ‘is_shop’, ) ); Or custom $wp_customize->add_section( ‘my-section’, array( ‘title’ => __( ‘Section Title’ ), ‘active_callback’ => ‘is_custom_condition’, ) ); function is_custom_condition(){ $condition_is_met = //Some boolean returning logic; if( ! $condition_is_met … Read more

How to upload multiple images with WP_Customize_Media_Control

Use this JQuery for multiple image uploads: <!– js multi image –> jQuery(document).ready(function($) { // add image uploader functionality var meta_image_frame; $(‘.meta-image-button’).live(‘click’, function(e){ e.preventDefault(); if( meta_image_frame ){ wp.media.editor.open(); return; } meta_image_frame = wp.media.frames.file_frame = wp.media({ title: ‘Portfolio Image Gallery Selection Window’, button: {text: ‘Add to Gallery’}, library: { type: ‘image’}, multiple: false }); meta_image_frame.on(‘select’, function(){ … Read more

WP Customizer – Prevent live preview

Visit this link and read about transporter argument: https://codex.wordpress.org/Theme_Customization_API Is that what you are looking for? Here is an example for you: <?php add_action( ‘customize_register’, ‘my_customizer’ ); function my_customizer($wp_customize){ $wp_customize->add_section( ‘my_section’, array( ‘title’ => __( ‘My Custom Section’, ‘mytheme’ ), //Visible title of section ‘capability’ => ‘edit_theme_options’, //Capability needed to tweak ) ); $wp_customize->add_setting( ‘my_setting’, … Read more