Skip to main content
Tweeted twitter.com/StackWordPress/status/933326316115505152

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

I also can't use is_page()is_page() because I only want to do something when the page.phppage.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.phpcommon-options.php which is getting included in almost all the templates (like index.phpindex.php, page.phppage.php, single.phpsingle.php and page_blog.phppage_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".

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 the 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".

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".

added 417 characters in body
Source Link
user1981248
  • 1.1k
  • 4
  • 14
  • 21

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 the 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".

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 the page.php is used, and not when some other custom Page template is used.

Please let me know about this and thanks!

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 the 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".

Source Link
user1981248
  • 1.1k
  • 4
  • 14
  • 21

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 the page.php is used, and not when some other custom Page template is used.

Please let me know about this and thanks!