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

1 Answer 1

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 and acknowledge you have read our privacy policy.

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