Remove ‘Menus’ from Twenty Sixteen theme Customizer

Thanks Dharmishtha, but I found the answer in below stack which worked really well without throwing any debug errors: How to remove menus section from WordPress theme customizer The correct way to disable ‘Menus’ and ‘Widgets’ (in Customizer) lies in creating a plugin with below code (taken from the above mentioned post to make it … Read more

How do I change Twenty Nineteen’s primary color without using the color slider in the theme customizer?

That’s indeed an interesting question. Looking at the following issues – both closed as won’t fix – I’d reason that replacing this color slider with a color picker is not recommended: https://github.com/WordPress/twentynineteen/issues/613 https://core.trac.wordpress.org/ticket/45619 Thing is, that Twenty Nineteen calculates the colors that will be displayed in the frontend from hue, saturation and lightness (HSL). And … Read more

Access Customizer’s DOM – jQuery

The customizer preview is in a different window than the window that contains the customizer controls. Specifically, the customizer preview is contained inside of an iframe. So that is why you cannot directly use jQuery to select elements. One way to work around this is to use parent.jQuery from the preview, but this is not … Read more

Using string instead of object class instantiation on the walker argument breaks wp_nav_menu

Apparently custom nav menu walkers are not supported though they were supposed to be. I’m surprised this only has been discovered now. However, there is an easy fix for you to get them to work. Just add this to your theme: add_filter( ‘wp_nav_menu_args’, function( $args ) { if ( isset( $args[‘walker’] ) && is_string( $args[‘walker’] … Read more

Conditional Logic to Check for Site Icon

There exists a special function to check if the site icon is set, namely the has_site_icon() function. So you could try: add_action( ‘wp_head’, ‘wpse_default_site_icon’, 99 ); add_action( ‘login_head’, ‘wpse_default_site_icon’, 99 ); function wpse_default_site_icon() { if( ! has_site_icon() && ! is_customize_preview() ) { // your default icons here } } The case when the site icon … Read more

How to mix partial and full page refresh in the same section of the customizer?

tl;dr See standalone example plugin that demonstrates initiating a full refresh when a selective refresh request enqueues different scripts or styles and also which re-initializes JS behaviors for selectively-refreshed partial placement containers. I understand the goal to be to minimize the amount of logic required in the customizer to preview changes to updated partials that … Read more

Where to get the unsaved list of widgets in customizer?

You can get the list of widgets in a sidebar via: wp.customize(‘sidebars_widgets[sidebar-1]’).get() This is a list of the widgets’ IDs. The sidebars_widgets[sidebar-1] is the setting ID for the sidebar. Replace sidebar-1 with the ID of your sidebar. So to get the count just do: wp.customize(‘sidebars_widgets[sidebar-1]’).get().length If you want to listen for when a widget is … Read more

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