Add PHP page/template in WordPress


Step 1: Create WordPress Template Page

We can start with a sample file and copy page.php, rename it on your choice and put it inside the theme folder ../wp-content/themes/mytheme/

This new file should start with the following content and then followed by the custom PHP content. This is the WordPress template.

Template Name: MyTemplate

/* other PHP code here */

Remember to upload this to the theme folder. Now the WordPress template is ready.

Step 2: Create WordPress Page

Click the “Pages” link from the WordPress Dashboard. The template we created can be used to create this new page. We can give the Page name and choose the “Template” from the drop-down from the “Page Attributes” section. There the PHP-page we uploaded will come with the “MyNewTemplate” listed in the drop down.


Now publish. Here we go, we have created a WordPress PHP page using our custom code. Whenever this page is linked, our custom PHP code will get executed. We can create any number of WordPress pages using this template.


By Ashutosh Pratap

I am software developer by profession and doing work and research in field of Computer programmings like PHP, WordPress, Magento, jQuery, Google APIs and many more web languages. Apart from this I write blogs on programming languages like PHP, Javascript, WordPress etc. I am also individual and independent Freelancer so you can hire me for your web work.

Leave a comment

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