WordPress.org

Ready to get started?Download WordPress

Forums

is_page_template() not working? (2 posts)

  1. Drew Baker
    Member
    Posted 3 years ago #

    Hey Guys,
    I'm getting some unexpected results with the conditional tag is_page_template().

    I have this in my header:

    <?php if ( is_page_template() ) { ?>
         <!-- Page template being used -->
    <?php } elseif ( is_page() ) { ?>
         <!-- Page template NOT being used -->
    <?php }; ?>

    When viewing a page without a template set, is_page_template() resolves as true for some reason. Does page.php count as a template?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    page.php counts as a page template.

Topic Closed

This topic has been closed to new replies.

About this Topic