Customizer live preview not working, refreshes but nothing change

Well, by some experiments, I found the answer. get_theme_mod won’t get you the real-time value when called in ‘after_setup_theme’ or ‘init’, it does work in ‘customize_preview_init’ and ‘wp_loaded’, so the working code: add_action(‘customize_preview_init’, ‘my_header’ ); function my_header() { if(get_theme_mod(‘enable_vertical_header’)) { $vertical_header = new Vertical_Header; } }

Is there any function that would allow me to register custom stylesheets for the Customizer itself?

If you’re after getting custom CSS ontop of WordPress’s Admins Customizer buttons, inputs, and controls – you can do something like this: add_action( ‘admin_enqueue_scripts’, function(){ $screen = get_current_screen(); if ($screen->base == ‘customize’) { wp_register_style( ‘custom_wp_admin_css’, plugins_url( ‘your-file.css’, __FILE__ ), //get_template_directory_uri().’your-file.css’, false, filemtime( plugin_dir_path( __FILE__ ) . ‘/your-file.css’ ) // get_template_directory() . ‘/your-file.css’ ) ); wp_enqueue_style( … Read more

Issue with Customizer: only last field shown in section

WP_Customize_Color_Control takes 3 parameters: /** * @param WP_Customize_Manager $manager Customizer bootstrap instance. * @param string $id Control ID. * @param array $args Optional. Arguments to override class property defaults. */ The problem with the original code is that you’ve passed the same Control ID (link_color) to two separate instances. So, the most recently added control … Read more

Theme customization based on grouped pages

You can either: A: Use Posts rather than Pages. WP enables Categories on Posts by default, so it’s easy to select a Category for each Post (all categories are shown with checkboxes, or it’s easy to add a new one). B: Use Pages, and create a custom “Page Category” taxonomy to categorize them, which also … Read more

Customizer Add Section argument ‘active_callback’ => “is_front_page” not working

The problem was I had multiple loops that each had different queries on the front page. After making sure to reset them each time, this problem resolved itself. For instance, my new query and loop looks like this: query_posts( array( ‘category_name’=>”Cloud, Customer Engagement, Developers, Executive Thought Leadership, Networking, Services, Solutions, Team Engagement”, ‘showposts’=>8, ‘order’=>DESC )); … Read more

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