When your website means business.

Javascript, WP/CP | Type: JavascriptRemove Metabox from Template

When you need a particular metabox to disappear from a particular template.

//my-admin.js (enqeue script in functions file)
//remove MapPress API on pages except for page_map.php
(function($){
$(document).ready(function() {
    var $page_template = $('#page_template')
        ,$metabox = $('#mappress'); //targets mappress metabox
    $page_template.change(function() {
        if ($(this).val() == 'page_map.php') { //template we want map on
            $metabox.show();
        } else {
            $metabox.hide();
        }
    }).change();
});
})(jQuery);

Reference Links

Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Cookies Notice