removing wordpress theme select from customizer

Dear Team

Another question, perhaps you could help me with that.

With Wordpress version 4.2 the possibility to switch theme has been brought to the customizer. Since my customers only work with a bb-child-theme they don’t need to switch theme. Is there a simple way of removing that from the customizer? Some month ago Justin explained me how to remove bb-modules from the customizer:

function baldverheiratet_remove_customizer_controls( $wp_customize ) {
     $wp_customize->remove_section( 'fl-presets'); 
     $wp_customize->remove_section( 'fl-content-blog');
     $wp_customize->remove_section( 'fl-content-posts'); 
     $wp_customize->remove_section( 'fl-content-woo'); 
     $wp_customize->remove_section( 'fl-content-archives'); 
     $wp_customize->remove_section( 'fl-lightbox-layout');
     $wp_customize->remove_section( 'fl-js-code-section');
     $wp_customize->remove_section( 'fl-head-code-section');
     $wp_customize->remove_section( 'fl-header-code-section');
     $wp_customize->remove_section( 'fl-footer-code-section');
     
     } 
add_action( 'customize_register', 'baldverheiratet_remove_customizer_controls', 999 );

Can I do something similar to get rid of that theme selector?

Thanks for helping me with that.
Dominic

I’m not sure if there is an official way to remove that (you may try the .org forums), but you could probably do that with some CSS. Here’s a rough example of the PHP you would need for that…

function my_customizer_css() {
    	wp_enqueue_style( 'my-customizer-css', 'PATH_TO_YOUR_THEME/css/customizer.css' );
}
	
add_action( 'customize_controls_enqueue_scripts', 'my_customizer_css' );

In your customizer.css file, you’ll need this CSS…

#accordion-section-themes { display: none; }

That only hides the section for the theme switcher. I believe there are other entry points for the theme switcher, so you may want to look into an official solution in the long run.

Justin

Hey Justin

Thanks for that code snippet.

Best
Dominic

Hey Justin

I’ve found another solution (thanks to: http://aristeides.com/blog/howto-remove-themes-changer-wp-customizer)

Just to complete the topic:

/**
 * This function removes the themes section from the customizer.
 */
function custom_remove_themes_section() {
    global $wp_customize;
    $wp_customize->remove_section( 'themes' );
}
add_action( 'customize_register', 'custom_remove_themes_section' );
  • Dominic

Awesome! Thanks for sharing!

Justin