Site icon Hip-Hop Website Design and Development

What does is_page_template() compare against?

Looking through the WordPress documentation, it says that is_page_template() compares against a “template name”, if one is provided.

I have a template stored in page-homepage.php called Homepage:

/*
 * Template Name: Homepage
 * Description: The template for displaying the homepage
 */

And I have some code I wish to run in my functions.php when I’m using that template:

if (is_page_template('Homepage')) { 
   ...

But it isn’t being triggered when I’m on a page which uses that template.

When I look at the code that WordPress executes for is_page_template(), it looks like it actually checks for the document name, not the template name…?

function is_page_template( $template = '' ) {

    $page_template = get_page_template_slug( get_queried_object_id() );

    if ( $template == $page_template )
        return true;

In my instance it seems that $page_template is page-homepage.php — not the template name, like the documentation suggests…?

Am I doing something wrong?