0

I'm trying to hide/show metaboxes dependant on the page template chosen. This has been working fine until I have come to show a metabox on more than one chosen page template.

The below code displays the Rich Content Editor for default pages, but not page-child.php pages. I'm guessing I have written the code incorrectly:

(function($){
    $(function() {
        $('#page_template').change(function() {
            $('#postdivrich').toggle($(this).val() == 'page-child.php') ;
            $('#postdivrich').toggle($(this).val() == 'default') ;
        }).change() ;
    }) ;
})(jQuery) ;
0

After much pulling of hair here is the answer should anybody require it:

(function($){
    $(function() {
        $('#page_template').change(function() {
            $('#postdivrich').toggle($(this).val() == 'page-child.php' || $(this).val() == 'default') ;
        }).change() ;
    }) ;
})(jQuery) ;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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