1
votes

I am using a simple theme in WordPress, that pulls it's customizers sections from the plugin ThemeHunk Customizer.

I want to hide certain sections in the customizer section, but when using $wp_customize, it isn't working.

This is what I am trying to hide:

$wp_customize->add_section('section_home_ordering', array(
    'title'    => __('Section Ordering', 'featuredlite'),
    'priority' => 3,
));

This is located in the /wp-content/plugins/themehunk-customizer/featuredlite/customizer/customizer.php file.

I have added this to my functions.php file in my child theme directory:

function customize_register_init( $wp_customize ){
    $wp_customize->remove_section('section_default_home');
    $wp_customize->remove_section('pro_button');
    $wp_customize->remove_section('Docs_button');
    $wp_customize->remove_section('section_home_ordering'); - THIS IS THE SECTION I would like removed from the /plugin/ file
}
add_action( 'customize_register', 'customize_register_init', 99 );

It doesn't seem to remove though, like it would if you were removing a section from a parent theme.

Is there another method to do this, or is this not possible to remove from a plugin rather than a parent theme?

Thank you in advance.

SOLVED I use the customize_controls_enqueue_scripts hook to input custom CSS within the wordpress customizer, so I can display certain elements as hidden!

2
As far as I know ThemHunk customize section includes options to hide certain section from the customize panel in Appearance > FrontPage Section customize. And more over it won't be ideal practice to remove section from plugin. You can simply can go with the css based solution using display: none; property for particular section using unique Id or Class.Nirmohi
@nir Thanks for your reply... there is no Appearance > FrontPage Section customize available.jpopuk
Can you tell me which WordPress theme you are using ?Nirmohi
@nir OneLine Lite is the theme I am using.jpopuk

2 Answers

0
votes

In theme your code works fine. Maybe it depends on action hooks order. Have you tried?

add_action( 'plugins_loaded', 'customize_register_init', 99 );
0
votes

You can simply go with these documentation as it shows you can disable particular section of Home Page (FrontPage). You can change order of appearance also from the Appearance > Frontpage Section > Section Ordering.

Reference Link: https://themehunk.com/docs/shopline-theme/#frontpage-section

https://themehunk.com/product/shopline-free-shopping-theme/