is_page_template giving wrong answer on site
-
I have a new site that is running on DreamHost (their standard WordPress 4.4.1 installation) and I have installed a commercial theme that is not working properly. I have tracked the problem to getting the “wrong” answer from the
is_page_template
function on my site. The theme author claims she is running the same version of WordPress and is not seeing the same results. The theme uses this function to conditionally enqueue some scripts and on my site, the needed scripts are not being included. On my site, I’ve added the following test:echo '<!-- DEBUGWH '.get_page_template(); if (is_page_template( 'page-home.php' )) { echo ' is page-home'; } else { echo ' is not page-home'; } echo '-->';
The output of this code on my site is:
<!-- DEBUGWH site-prefix/wp-content/themes/wp-newjerusalem/page-home.php is not page-home-->
So get_page_template says the template is page-home.php but is_page_template says that it is not, a contradiction.
The code appears in an appropriate point in the functions.php file and the author has a demonstration site where the results are correct. I am not sure she has the exact same version of WordPress.
I am at a loss as to where to go next to resolve this issue.
You can currently set this in action at https://www.bethdavidri.org
- The topic ‘is_page_template giving wrong answer on site’ is closed to new replies.