Steps to create a new WordPress page template: Create a text file and name it template-name.php. Add code, including template name, header, footer, and custom content. Save the file to your theme's /templates folder. Refresh the backend and select a template on the New Page screen.
How to create a new WordPress page template
WordPress page templates are pre-designed templates used to create a specific format or layout page. These templates are typically used to create custom landing pages, archive pages, or blog post list pages.
To create a new WordPress page template, follow these steps:
Step 1: Create a new file
template-name.php
, wheretemplate-name
is the template name of your choice.Step 2: Add Template Content
Paste the following code in the text file:
Step 3: Place the template content
in theget_header();andget_footer();functions place your template content in between. This can include any HTML, PHP and WordPress functions.
Step 4: Save the File
Save the text file into the/templates
folder of your WordPress theme directory.
Step 5: Refresh Page
Refresh your WordPress backend and go to the New Page screen. You should now see the new template you created appear in the Templates drop-down list in the Page Properties box.
Step 6: Use a template
Choose your new template and create a new page. WordPress will use this template to render the page.
The above is the detailed content of How to create a new page template in wordpress. For more information, please follow other related articles on the PHP Chinese website!