2

Like above, when I add Panel to Customizer, its description does not show up. Moreover, section description shows correctly. Even more, the element in DOM exists but it has display:none; property inherited from some default styles. This is what I'm doing:

$wp_customize->add_panel('mypanel', array(
    'title'         => __('My awesome panel', 'domain'),
    'description'   => __("This is the description which doesn't want to show up :(", 'domain'),
    'capability'    => 'edit_theme_options',
    'priority'      => 2
));

$wp_customize->add_section('mysection', array(
    'title'    => __('My even more awesome section', 'domain'),
    'panel'    => 'mypanel',
    'description' => __('Section description which does show up', 'domain')
));

$wp_customize->add_setting('mysetting', array(
    'settings'          => 'mysection',
    'capability'        => 'edit_theme_options',
    'sanitize_callback' => 'sanitize_text_field'
    ));

$wp_customize->add_control('mycontrol', array(
    'label'   => __('The most awesome control', 'domain'),
    'section' => 'mysection',
    'type'    => 'text'
));

Like I said, the description <div> actually exists in DOM structure but it has CSS style which blocks its displaying:

HTML:
enter image description here

CSS:
enter image description here

QUESTION: Why is it happening and how can I make the description visible?

1 Answer 1

2

I needed to tweak the settings and controls code a bit to get them to work:

$wp_customize->add_panel('mypanel', array(
        'title'         => __('My awesome panel', 'domain'),
        'description'   => __("This is the description which doesn't want to show up :(", 'domain'),
        'capability'    => 'edit_theme_options',
        'priority'      => 2
));

$wp_customize->add_section('mysection', array(
        'title'    => __('My even more awesome section', 'domain'),
        'panel'    => 'mypanel',
        'description' => __('Section description which does show up', 'domain')
));

$wp_customize->add_setting('mysetting', array(
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'sanitize_text_field'
        ));

$wp_customize->add_control('mycontrol', array(
        'settings' => 'mysetting',
        'label'   => __('The most awesome control', 'domain'),
        'section' => 'mysection',
        'type'    => 'text'
));

The main thing here is that Panel descriptions are only shown once the ? icon is clicked:

Reveal Panel description

2
  • 1
    Haha I can't believe I haven't check it! :D Thank you very much! I spent so much time looking for an answer and it turned out so obvious. Thanks again! Commented Nov 10, 2016 at 7:30
  • Happy to help! It wasn't obvious to me either. I had to go through the whole process of setting up the customizer and troubleshooting from there. Commented Nov 10, 2016 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.