There are two types of php page available in wordpress for posting your content. One is “post.php” and other is “page.php”. There is a detail list of wordpress template files available here. Most of the time you have to play with these two type of php files to display your articles. “Page.php” mostly used to display the content on menu items where as “post.php” used to display blog posts. Pages are mostly independent in nature where as post are linked to specific category.
Some times you want to add a php page to perform other operations which can’t be done by using default php pages. so this article will help you to add a new php page in wordpress. This is also considered as a new template in your wrodpress theme folder.
Now if you add a new php page in your wordpress template file then just follow these easy steps. This is very easy and helpful. Make proper backup before make changes.
- Create a new file php file. E.g “yourtemplate.php”.Add this file in you wordpress theme you are currently using.
- Add following code on the top of the file.
<?php /* Template Name: yourtemplate */ ?>
- You can now add you custom php code in this file according to you requirements.
- Now create a new page. On page make screen there is a widget named “Page Attributes” at the right of the edit. Select the template from here and publish it.
- Your new page will use the custom template now. It will reflect the chnages you made in template file. It will update data according to the changes made on your template file.
This is very easy and helpful. I hope you can understand easily. I used screenshots to make it more useful and understandable. Feel free to post comments and let me know if you are facing any problem.