get_page_template


get_page_template ( No parameters )

See:
Returns:
  • (string) Full path to page template file.
Defined at:
Change Log:
  • 4: .

Description

Retrieve path of page template in current or parent template.

The hierarchy for this template looks like:

  1. {Page Template}.php
  2. page-{page_name}.php
  3. page-{id}.php
  4. page.php

An example of this is:

  1. page-templates/full-width.php
  2. page-about.php
  3. page-4.php
  4. page.php

The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where $type is 'page'.

Related Functions

get_paged_template, get_page_templates, get_tag_template, get_date_template, get_page_template_slug

Top Google Results

User discussions

wpseek mobile