Hi, I noticed your last post came through my email with “Never mind, I missed a previous post about this!” but your post is blank. Do you still need help?
Yea, I do. I changed my original post to another question that I had
Ahh I see. Are you familiar with Javascript? You’ll want to hide the metabox using CSS/JS by default and then use a change event or similar on the radio button to show the metabox when the gallery post format is selected.
Javascript is probably one of my weaker points right now. Are you able to provide a snippet of what it would look like?
Thanks
I can’t seem to get that code you provided in the link working. I currently have this:
<script>
$( document ).ready( function($)
{
$( "#easy_image_gallery" ).addClass( "hidden" );
if( $( "input#post-format-gallery" ).is(':checked') ){
$( "#easy_image_gallery" ).removeClass( "hidden" );
}
$( "input#post-format-gallery" ).change( function() {
if( $(this).is(':checked') ){
$( "#easy_image_gallery" ).removeClass( "hidden" );
}
} );
}
);
</script>
I have opened your code and found the id of your metabox to be ‘easy_image_gallery’, but I’m not entirely sure if that value is supposed to go where is currently is. Any help would be appreciated.
Is the metabox successfully getting the “hidden” CSS class when you look at the source? Have you written the CSS for the hidden CSS selector?
The metabox is not getting a hidden css class. I tried using the code snippet above in the developer tools console in chrome and it works, but anywhere else, it has no effect.
Where did you put the Javascript? Are you correctly loading it in the admin footer? If you view the source, is it there?
The javascript is currently in my header.
Would I need to change my approach and look towards this:
http://codex.wordpress.org/Function_Reference/wp_enqueue_script