Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does Wordpress add hide-if-js class to metaboxes

I have 2 metaboxes added to "page" type. But only in first case Wordpress (on its own) adds hide-if-js class to metabox container. Questin is - when does Wordpress add this hide-if-js to the metabox container div ??

First metabox add code - this one gets hide-if-js class automatically:

add_action( 'add_meta_boxes', 'add_portfolio_template_meta' );
 function add_portfolio_template_meta() {
add_meta_box('projects-details-for-template', 'Portfolio template options:', 'projects_details_for_template_html', 'page', 'side', 'default');

}

Second metabox add script:

add_action( 'add_meta_boxes', 'add_contact_template_meta' );
function add_contact_template_meta() {
add_meta_box('contact-details-for-template', 'Contact page details:', 'contact_details_html', 'page', 'side', 'default');

}
like image 814
Vitalie Avatar asked Feb 25 '13 13:02

Vitalie


1 Answers

Just ran into this today. Turns out it's related to the top "screen options" section (top right of the backend when editing a post, pulls open a new div).

The "hide-if-js" class will be on your metabox when the page is loaded if it's unselected in "screen options". To remove the class/make the metabox visible, check it off.

like image 105
Kaitlyn McDonald Avatar answered Nov 15 '22 20:11

Kaitlyn McDonald