WordPress has a functionality that I have never used before that allows you to create pages rather than just posts. I never really found a reason for this until recently where I decided to change my landing page to go to this new page in my blog I created. After creating the page I didn’t like the fact it had a post date, a category classification, and the comments section. Looking into WordPress.org I found out how I can attach a specific template file to a specific page. This was pretty easy but I figured I would write it down so I wouldn’t have to search for it again.
- Copy the page.php file from the current theme
- Create a new file with the copied contents from page.php
- Add the following code snippet to the new file
- Edit the file to be how you want it, and upload to your template directory
- In WordPress when editing or creating the page you should see a new dropdown that allows you to choose the page template (see image for post)
| <?php /* Template Name: About */ ?> |
That’s it now you have a new customized page template for whatever you want to do!
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.