Toggle admin metabox based upon chosen page template
Is this possible to change editor screen immediately after someone picks some template from the drop down?
I need a metabox shown only when page template is
page-portfolio.php. I know I can use this code:
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE);
And than add my boxes using
if statements. The problem is it doesn't work immediately. Is this even possible without very complex coding to do "catch" moment when user changes templates list without saving?