Articles of theme customizer

create drop down menu in theme customizer from custom db

what i am trying to do is create drop down menu in theme customizer from custom db i have created. db name “students”. in the db i have only the id and the name. i want to show all students names in the drop down menu. and when the user will choose some of the […]

Input ordering in wordpress theme customizer

I’m trying to add custom fields to the wordpress theme customizer for the theme that I’m creating. $wp_customize->add_section( ‘sometheme_theme_customization_section’, array( ‘title’ => __(‘Settings’, ‘sometheme’), ‘description’ => ‘Custom settings for the sometheme theme’, ‘priority’ => 35, ) ); $wp_customize->add_setting( ‘sometheme_headline’, array( ‘default’ => ”, ‘sanitize_callback’ => ‘sometheme_sanitize_text’ ) ); $wp_customize->add_control( ‘sometheme_headline’, array( ‘label’ => __(‘Headline’, ‘sometheme’), […]

adding checkbox to theme customizer

I have been trying to add a checkbox into the theme customizer. I have a checkbox added using this code in my functions.php function theme_customizer_register_checkbox($wp_customize) { $wp_customize->add_section( ‘savior_global_options’, array( ‘title’ => ‘Global Options’, ) ); $wp_customize->add_setting( ‘show_supporters’, array( ‘default’ => true, ‘type’ => ‘option’, ‘capability’ => ‘edit_theme_options’ ) ); $wp_customize->add_control( ‘display_supporters’, array( ‘settings’ => ‘show_supporters’, […]

add_theme_support('custom-header') does not add the option to customize

I am using this to get custom header support to my new theme: function my_add_header_support() { $ch_defaults = array( ‘default-text-color’ => ”, ‘default-image’ => ”, ); add_theme_support( ‘custom-header’, $ch_defaults ); } add_action( ‘after_setup_theme’, ‘my_add_header_support’ ); I expected a headers section to show up under Appearance – Customize in the dashboard, but it does not. There […]

Customizer: Update Preview instantly when typing into a number input field

Im working on some customizer settings for my theme. Im using chrome. I created a number input field: $wp_customize->add_setting( ‘st_opacity’, array( ‘default’ => ‘100’, ‘type’ => ‘theme_mod’, ‘capability’ => ‘edit_theme_options’, ‘transport’ => ‘postMessage’, ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, ‘st_opacity’, array( ‘label’ => ‘Opacity (%)’, ‘section’ => ‘sitetitle_options’, ‘settings’ => ‘st_opacity’, ‘type’ => ‘number’, ‘input_attrs’ […]

Running JS after theme customizer finished initialization

I have a piece of JS code that I use show/hide customizer control groups depending on a select item value. The code was working fine until recent wp update (not sure which version first broke this). Here is the code for enqueuing the js file. add_action(‘customize_controls_print_scripts’, ‘ppl_customize_controls_scripts’); function ppl_customize_controls_scripts(){ wp_register_script( ‘ppl-customize-control’, get_template_directory_uri().’/js/customizer-control.js’, array(‘jquery’), 1, true); […]

How to suppress anchor tag click redirection in customizer preview frame?

I’ve noticed 3 scenarios relating to links in the customizer preview frame. 1) Clicking a link to an external url does nothing. This is good. 2) Clicking a link to a same origin/domain url results in refreshing the customizer preview with that url’s content. Again, good. 3) Clicking on a link with a hash or […]

Removing http:// from esc url() for wordpress customizer code

I’ve been trying to figure this out for a few days now and I’ve now come to the understanding I need help. I’ve never worked with the wordpress customizer but have been recently interested in adding additional text fields and image uploads to my themes I customize (I’m finding this quite difficult as not only […]

Dynamic IDs in WordPress Customizer value bindings

I’m trying to create WordPress Customizer bindings based on dynamic ID’s, like this for (var i=0; i < myarray.length; i++) { wp.customize( ‘custom_width_’+ myarray[i], function( value ) { value.bind( function( to ) { $( ‘#’+myarray[i] ).css( ‘min-width’, to ); }); }); } The code is a something I pilfered from the twentyseventeen theme (customize-preview.js) then […]

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

I am wondering if it is possible to add placeholder text for WordPress Customizer input fields especially text and textarea fields. I have added a input control by the code below. Can anyone tell me how I can add placeholder text to the input field? $wp_customize->add_control(‘directorist_address’, array( ‘label’ => __(‘Address’, ‘directorist’), ‘section’ => ‘directorist_contact’, ‘settings’ […]