Where Are Page Templates Located in WordPress?

Page templates are located in the wp-content/themes/[theme]/page-templates folder. Most themes have a default page template that you can use as a starting point.

To create a new page template, create a file called -page-template.php and include the following code:.

To use a page template in a WordPress post or page, include the following line in the post or page header:

__(‘Title’, ‘My Awesome Page’); ?>

To use a page template in a WordPress plugin, include the following line in the plugin header:

__(‘Description’, ‘My Awesome Page’); ?>

To use a page template in a WordPress theme, include the following line in the theme header:

__(‘Version’, ‘1.0’); ?>

The WP_Page_Template class provides many convenient methods for creating and managing page templates. For example, you can use the get_page_template() method to get a reference to the current page’s template, and the set_page_template() method to set the template to use for the current page.