Have you wondered how some people have completely different looking pages on their WordPress site or blog. In this tutorial we will show you how you can create a custom page in WordPress using the custom page template snippet. A custom page is helpful if you want to have a page that looks completely different than rest of your blog but still runs on the WordPress CMS. You can also use it as a homepage or a landing page.
To customize the design and edit styling for the page, HTML and CSS knowledge would be helpful.
You will begin creating a custom page by opening a blank file in your text editor and paste the following code at the very top:
<?php /* Template Name: WPBeginnerT1 */ ?>
Once you have added the code, save the page as: blog[templatename].php so it will be blogwpbeginner.php for this example. You can name it any other structure you like as long as it is a php file.
The above code is simply giving your template a name that you will later see that WordPress recognize, so we are calling our template WPBeginnerT1 but you can call it whatever you like for example, archive, contact, landingpage etc.
This page can use all php markups as your other pages can. If you need help you can use our WordPress Theme Cheat Sheet for Beginners. You can start out by calling WordPress header and footer, or you can go completely solo by doing everything in HTML.
If you do not call header.php, then you must make sure to add all the header information such as style.css and others.
Once you have completed editing this file save it and upload it in your theme directory (/wp-content/themes/yourthemedirectory/) where files like single.php and index.php are located.
Next you will need to login to your WordPress admin panel and Add a New Page. Since you have already written down all the text and settings in the php file, simply name the page and leave the content area blank. Look on the right hand side, you will see a box called Attributes below the publish button. Choose the template using the drag down button.
Add the Meta Information such as Title, Description and such if you have the SEO Plugin and Publish the page. Now this page will be using the template you specified.
But if you left the option for the content to be dynamic, then you will need to add content via the admin panel.
This is a very helpful tutorial for designers specially when using WordPress as a CMS.