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

WP Customizer API loaded into functions.php

Yes. You can load the code in the customize_register action. One example: <?php // File: functions.php add_action( ‘customize_register’, function( $wp_customize ) { require_once dirname( __FILE__ ) . ‘/inc/customize.php’; wpse256532_customize_register( $wp_customize ); } ); And the inc/customize.php file: <?php // File: customize.php function wpse256532_customize_register( $wp_customize ) { $wp_customize->add_setting( /* … */ ); $wp_customize->add_control( /* … */ … Read more

Remove Customizer Control Choices (Type: Radio Array) using Child Themes

You can assign a new array there, with the updated options: $wp_customize->get_control( ‘your_control_id’ )->choices = array( ‘top’ => ‘top’, ‘bottom’ => ‘bottom’ ); used this in my functions.php function modify_choice( $wp_customize ){ $wp_customize->get_control( ‘your_control_id’ )->choices = array( ‘top’ => ‘top’, ‘bottom’ => ‘bottom’ ); } add_action( ‘customize_register’ , ‘modify_choice’,999 );

Customizer: get_preview_url() inside customize_save_after hook

I managed to do it via JS, it does exactly the same thing at the time I want it to: wp.customize.bind( ‘saved’, function( d ){ $.ajax({ url: ajaxurl, type: ‘post’, dataType: ‘json’, data: { action: ‘actionName’, url: wp.customize.previewer.previewUrl() } }); }); I can then use the preview URL in an ajax action function. Don’t forget … Read more

How to call custom jQuery plugins into the customizer controls

First, in order to enqueue JS in the customizer controls, you need to use the customize_controls_enqueue_scripts action. This is different than the action used to enqueue scripts into the customizer preview, which is what themes normally do via customize_preview_init or wp_enqueue_scripts. So in your snippet above, replace customize_preview_init with customize_controls_enqueue_scripts. Secondly, in order to extend … 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:

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