With php there is a wordpress function is_page_template()
Is there a similar function written in jquery/javascript?
To use with the wp.customize
api and jquery/javascript.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityWell, yes, in WordPress, different templates have a different body class name. If you inspect the body classes on a specific page in WordPress, there should be a body class page
. You can detect the template by checking if the class exists like so:
jQuery(document).ready(function($){
if ( $('body').hasClass('page')) {
// add your logic here
}
});
active_callback
argument foradd_control()
.