I’m currently using a version of this function – post formats – how to switch meta boxes when changing format? which hides all meta boxes until a corresponding post format is selected (Ie; If someone selects “Video” then my custom Video meta box shows up)
But when the post is saved all the meta boxes become hidden again unless I reselect the post format.
Is there a way to show the appropriate meta box even when the post has been saved?
This is the main function;
jQuery( document ).ready( function($)
{
// Starts by hiding the "Video Options" meta box
$( "#video-options" ).addClass( "hidden" );
// If "Video" post format is selected, show the "Video Options" meta box
$( "input#post-format-video" ).change( function() {
$( "#video-options" ).removeClass( "hidden" );
} );
}
);
Try this one:
);