I’m using the following JQuery script from this answer to toggle the display of metaboxes dependant on the Page Template selected. The example below shows the featured image metabox when the default template is selected:
(function($){
$(function() {
$('#page_template').change(function() {
$('#postimagediv').toggle($(this).val() == 'default');
}).change();
});
})(jQuery);
My possibly simple question is… How do I get this code to only show the featured image box for my Page Template entitled: Services?
I have tried simply changing the 'default'
to ‘Services'
but no luck.
The
value
is not the same thing that you see when you look at the toggle. That part is for humans. To see the value you have to look at the source of the page. If you have a template created bytemplate.contact.php
thevalue
in that box would betemplate.contact.php
, so it looks like thevalue
is thephp
file name.The value of the select is setted to the file name so, assuming youf template file is
services.php