How to add a new Page Template to WordPress

You have to do two things to add a new page template to WordPress.

1. Add a file with the correct name

WordPress uses a template hierarchy – you need to give your template the right name. Either page-ID.php – where ID is the post ID of the page you are targeting, or page-SLUG.php – where SLUG is either the slug of the page you are targeting or an understandable name you can assign through the page interface to pages.

2. Add a ‘Template Name’ declaration at the start of your template file

For WordPress to pick your template up, you need to start each page template file with a Template Name string followed by a unique name for the template:

Template Name: Offer page template

What do you think?

Your email address will not be published. Required fields are marked *