Customizer active callback live toggle controls

The answer was to ‘decouple’ live preview and contextual control. If I place them together, I cannot use the same action hook – live won’t work on customize_controls_enqueue_scripts and contextual control won’t work on customize_preview_init. So the answer is: add_action( ‘customize_controls_enqueue_scripts’, ‘mytheme_customizer_control_toggle’ ); add_action( ‘customize_preview_init’, ‘mytheme_customizer_live_preview’ ); /** * Live preview script enqueue * * … Read more

Add button to Customizer

There are three things you need to do in particular. As there are no settings associated with the control, you need to explicitly supply an empty array for settings, as otherwise it will try to look for a setting ID that matches the control ID (here button_id); since that setting never gets created, the control … Read more

How do I use add_control to offer a list of all pages in the customiser?

To add a Customiser control for selecting a page from a dropdown you just need to set the type argument to dropdown-pages: $wp_customize->add_control( array( ‘type’ => ‘dropdown-pages’, ‘section’ => ‘my_custom_section’, ‘label’ => __( ‘Pick a page, bub’ ), ) ); This will give you a control that’s a <select> dropdown with a list of pages … Read more

Why does get_theme_mod return blank (or default value) but get_option returns saved value?

This is original code from wordpress: function get_theme_mods() { $theme_slug = get_option(‘stylesheet’); $mods = get_option(“theme_mods_$theme_slug”); if (false === $mods) { $theme_name = get_option(‘current_theme’); if (false === $theme_name) $theme_name = wp_get_theme()->get(‘Name’); $mods = get_option(“mods_$theme_name”); // Deprecated location. if (is_admin() && false !== $mods) { update_option(“theme_mods_$theme_slug”, $mods); delete_option(“mods_$theme_name”); } } return $mods; } function get_theme_mods() { $theme_slug … Read more

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