It’s default page template?

It’s very short post. We know, if we need check what template used at some page we can use function is_page_template(). But what to do if we need check default page template that is page.php?

Problem: How to check is default page template?

How to check it’s default page template?

Solution: Here I'll give you some options to address.

First:

<?php
if ( basename(get_page_template()) === 'page.php' ) {
	// some code
}

Second:

<?php
if ( is_page() && !is_page_template() ) {
	// some code
}

Sources:

  1. https://gist.github.com/zackn9ne/3344158/
  2. https://wordpress.stackexchange.com/questions/149803/conditional-tag-to-check-if-page-php-is-being-used/

Leave Comment

Your email address will not be published.