Create new WordPress Custom Template Page (PHP)

Purpose: Create new WordPress Custom Template Page (PHP)

A WordPress PHP script. Taken from the WordPress offical codex, just for a personal note.

Reference: http://codex.wordpress.org/Page_Templates

 

Custom Page Template
Create a template that can be used by any Page: A Custom Page Template can be used by multiple Pages (see Selecting a Page Template above). To create a custom page template make a new file starting with a Template Name inside a PHP comment. Here’s the syntax:

1
2
3
4
<?php
/*
Template Name: My Custom Page
*/
<?php
/*
Template Name: My Custom Page
*/

Once you upload the file to your Theme’s folder, the template name, “My Custom Page”, will list in the Edit Page screen’s Template dropdown. (The select list has a maximum width of 250px, so longer names may be cut off.)

A quick, safe method for making a new Page template is to use with a copy of your page.php: This way you start off with the HTML structure of your other pages, then you can edit as needed.

A custom page template file can be in a sub-folder, or, if using a Child Theme, in its Parent Theme’s folder.

Leave a Reply

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


eight − one =

Post Navigation