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

I actually ran into the same problem myself and my solution was this code:

if(basename(get_page_template()) === 'page.php'){

}

basename(get_page_template()) gets the filename of the page template (according to https://codex.wordpress.org/Function_Reference/get_page_template) and we then check if it is equal to 'page.php'

Leave a Comment