page-about.php
is more specific than the template files page.php
or index.php
as it will only affect a page with the slug of “about.”page-{slug}.php
-- If no custom template has been assigned, WordPress looks for and uses a specialized template that contains the page’s slug.page-{id}.php
-- If a specialized template that includes the page’s slug is not found, WordPress looks for and uses a specialized template named with the page’s ID.page.php
-- If a specialized template that includes the page’s ID is not found, WordPress looks for and uses the theme’s default page template.singular.php
-- If page.php
is not found, WordPress looks for and uses the theme’s template used for a single post, irregardless of post type.index.php
-- If no specific page templates are assigned or found, WordPress defaults back to using the theme’s index file to render pages.paged.php
. It is not used for the page post-type but rather for displaying multiple pages of archives.page_two-columns.php
page-
as a prefix, as WordPress will interpret the file as a specialized template, meant to apply to only one page on your site. page.php
and give the new file a distinct filename. Merlin%40home transmitter wifi. That way, you start off with the HTML structure of your other pages and you can edit the new file as needed.On the right hand side under attributes you'll see template. This is where users are able to access your global page templates.
Tip: The select list has a maximum width of 250px, so longer names may be cut off.
page.php
file and rename it with your page’s slug or ID:page-{slug}.php
page-{ID}.php
page-about.php
or page-6.php
, then WordPress will automatically find and use that file to render the About page.page.php
file. For instance, the below example code loads the file header-home.php
for your front page, but loads another file (header-about.php
) for your About page, and then applies the default header.php
for all other pages.body_class()
function, WordPress will print classes in the body
tag for the post type class name (page
), the page’s ID (page-id-{ID}
), and the page template used. For the default page.php
, the class name generated is page-template-default
:page-{slug}.php
or page-{ID}.php
) also gets the page-template-default
class rather than its own body class.page-template
will print, along with a class naming the specific template. For example, if your custom page template file is named as follows:page-template-my-custom-page-php
class that is applied to the body
tag.get_page_template()
returns the path of the page template used to render the page.wp_get_theme()->get_page_templates()
returns all custom page templates available to the currently active theme (get_page_templates()
is a method of the WP_Theme
class).is_page_template()
returns true or false depending on whether a custom page template was used to render the page.get_page_template_slug()
returns the value of custom field _wp_page_template
(null
when the value is empty or “default”).If a page has been assigned a custom template, the filename of that template is stored as the value of a custom field named '_wp_page_template'
(in the wp_postmeta
database table). (Custom fields starting with an underscore do not display in the edit screen’s custom fields module.)