Customizer options

The easiest solution is to put it in your functions.php file in your theme’s directory. All the code in functions.php is automatically executed when the theme is active. If the code in the file gets too much you can choose to divide it in smaller files and include those files in functions.php EDIT You should … Read more

How do i remove the ‘WooCommerce’ section from Customizer in Twenty Sixteen Theme?

WooCommerce adds itself to the customizer as a “panel”, not a “section”. Add this to your my_customize_register() function and it will be gone: $wp_customize->remove_panel( ‘woocommerce’ ); References: woocommerce/includes/customizer/class-wc-shop-customizer.php line 31 As a rule of thumb, when you want to remove something (a customizer section, an action or filter, etc.) looking for how it is added … Read more

site identity section name?

The “Site Identity” section has the ID of title_tagline for historical reasons. If you want to see the IDs for the core sections, all you have to do is look at the source for WP_Customize_Manager::register_controls(). Alternatively, you can get a list of all the sections registered, whether by core or by plugins, by opening your … Read more

Customizer, change preview url when a control changes

Gonna have a go… say you have a theme option themeoption[id]… instead of setting transport refresh, set it to postMessage instead, and then add this code to create a callback that first gets the page URL via AJAX then sends that back to the previewUrl as you mentioned before refreshing… add_action(‘customize_preview_init,’preview_override_loader’); function preview_override_loader() { add_action(‘wp_footer’,’preview_override_script’); … Read more

Change “Display Site Title and Tagline” checkbox text in theme customizer

You will need to de-register that control. It will look like this: /** * Remove parts of the Options menu we don’t use. * * @param WP_Customize_Manager $wp_customize Customizer manager. */ function de_register( $wp_customize ) { $wp_customize->remove_control(‘display_header_text’); } add_action( ‘customize_register’, ‘de_register’, 11 ); For more information, this Theme Customization is a good start.

Removing pre existing menu item

Here you go: $wp_customize->remove_section(‘colors’); $wp_customize->remove_section(‘nav_menus’); $wp_customize->remove_section(‘static_front_page’); EDIT AFTER DISCUSSION After testing I found that this doesn’t work for nav_menus. You have to set a higher priority on the hook, like this: add_action( ‘customize_register’, ‘remove_nav_menu_section’, 20 ); This gives a php warning from WP but otherwise does the job.

WordPress Customizer sanitize_callback: How to Reset to Default on Fail

In the sanitize_callback function you can look at the second argument which is the WP_Customize_Setting instance and access the default property there when returning due to an empty provided value: add_action( ‘customize_register’, function( WP_Customize_Manager $wp_customize ) { $wp_customize->add_setting( ‘facebook_url’, array( ‘default’ => ‘https://www.facebook.com/USERNAME’, ‘sanitize_callback’ => function( $url, $setting ) { if ( empty( $url ) … Read more

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