How to use variable from customizer.php in customizer.js

Use wp_add_inline_script() to export the variable from PHP to JS. For example, in my_styles_method assuming that your customizr.js script has the handle my-styles-customize-preview: wp_add_inline_script( ‘my-styles-customize-preview’, sprintf( ‘var MyStylesSelector = %s;’, wp_json_encode( $custom_css ) ), ‘before’ ); Then you can modify for JS to be: wp.customize( ‘wpt_heading_color’, function( value ) { value.bind( function( newval ) { … Read more

How to add UI buttons in customizer like twentyseventeen

Your code is good i think you are missing the front-end part, here is the complete code for functions.php: /* Customizer fields */ function your_customizer_settings($wp_customize) { $wp_customize->add_section(‘footer_section’, array( ‘title’ => __(‘Footer Section’, ‘healthtech’), ‘panel’ => ”, )); /* * Settings for copyright text */ $wp_customize->add_section(‘footer_section’, array( ‘title’ => __(‘Footer Section’, ‘healthtech’), ‘panel’ => ”, )); … Read more

Hooks to watch customizer value change

This is very easy to do. What you want to do is hook into the customize_save_after action hook – https://developer.wordpress.org/reference/hooks/customize_save_after/ – and check your setting and based on it update another. Example: add_action( ‘customize_save_after’, function() { // Get the setting you want to retrieve value from $new_value_setting_1 = get_theme_mod( ‘SETTING_ID’ ); // Update another setting … Read more

Theme customizer not working

The simplest way to use this feature: Add add_theme_support( ‘custom-background’ ); to functions.php Use body_class() in your body tag like this: <body <?php body_class(); ?>> use <?php wp_head(); ?> in your head tag if you go to the customizer should look like this:

Allow multiple settings to be stored in a single option in Theme customizer

In your example here, the option stored would be named options and it would contain two array keys, toggle_header and background. To obtain the values, then, you would do: $options = get_option( ‘options’, array() ); $options = array_merge( array( ‘toggle_hedaer’ => true, ‘background’ => ‘normal’ ), $options ); // Accessing stored values here: $toggle_header = … Read more

Kirki: generate toggles for each taxonomy term

You can use a Kirki helper class for this (pass your taxonomy into Kirki_Helper::get_terms), but you need to register after the taxonomies are registered, otherwise you get an error: function my_theme_add_categories_customizer_control() { Kirki::add_field(‘my_config’, array( ‘type’ => ‘multicheck’, ‘settings’ => ‘show_months’, ‘label’ => esc_attr__(‘My Control’, ‘my_textdomain’), ‘section’ => ‘months’, ‘priority’ => 10, ‘choices’ => Kirki_Helper::get_terms(array(‘months’)) )); … Read more

Amend description of menu location in customizer WordPress

You need to be modifying a section not a setting. Try this: add_action( ‘customize_register’, function( $wp_customize ) { $section = $wp_customize->get_section( ‘menu_locations’ ); $section->description .= “<p>Custom HTML added.</p>”; }, 12 ); The priority of 12 is used because \WP_Customize_Nav_Menus::customize_register() happens at priority 11, and this is where the section is added.

Detect device change (desktop, tablet or mobile) in Customizer

Yes, the way to accomplish this would be to send messages from the Customizer controls pane window to the Customizer preview window when the wp.customize.previewedDevice value changes. So you can enqueue a script at the customize_controls_enqueue_scripts action with customize-controls as its script dependency that does: (function ( api ) { api.bind( ‘ready’, function() { function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)