is_page_template() written in jquery/javascript – WordPress Development Stack Exchange

Question

Well, 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
    }
});

0
Angel Hess 2 years 2022-03-27T11:35:00-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse