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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.