is_page_template() returns true or false depending on whether a custom page template was 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).get_page_template() returns the path of the page template used to render the page.These built-in WordPress functions and methods can help you work with page templates: Notice the page-template-my-custom-page-php class that is applied to the body tag. For example, if your custom page template file is named as follows: When using a custom page template, the class page-template will print, along with a class naming the specific template.
This section shows you how to build page templates that can be selected by your users through their admin screens.įor example, you can build page templates for: You can use page templates to achieve these things. Or, you may want to display a featured image that links to a post on one part of the page, have a list of latest posts elsewhere, and use a custom navigation. You may decide that you want your homepage to look a specific way, that is quite different to other parts of your site. Page templates display your site’s dynamic content on a page, e.g., posts, news updates, calendar events, media files, etc.
Note: If your template file is in a shared drive, check the sharing settings on the shared drive. Open an existing document, spreadsheet, presentation, form, or site and make the changes you want for your template.
Create a new document, spreadsheet, presentation, form, or site.