Conditional tag to check if ‘page.php’ is being used?


I’m trying to check whether the page.php template is being used or not. I’ve tried is_page_template( 'page.php' ) but it doesn’t work.

I also can’t use is_page() because I only want to do something when page.php is used, and not when some other custom Page template is used.

Please let me know about this and thanks!

Edit: Should have mentioned earlier that I have a file called common-options.php which is getting included in almost all the templates (like index.php, page.php, single.php and page_blog.php), in this file I’m trying to do the check with the following code:

if ( is_page_template( 'page.php' ) ) {
    echo "success!";

But it’s not working when I open a page that is using the “Default Template”.

, , user1981248 1 year 2020-07-27T11:10:51-05:00 0 Answers 47 views 0

Leave an answer