If you have ever wondered how some websites have pages that look drastically different from each other on their WordPress site, then this article is for you. We will show you in this tutorial how to create a custom page in WordPress by using a custom page template snippet. If you want a page to look completely different than the rest of your blog but still want to use WordPress as your content management system, then using a custom page is very helpful. This can also be used for landing pages or home pages.
Knowledge of CSS and HTML can be helpful for this but it is not needed.
To begin creating your custom page, you will need to open a blank file in a text editor of your choice. Put the following code at the top of this page.
/* Template Name: HostingTavernT1 */
After you have added this code, you need to save the page as: blog[templatename].php. For example bloghostingtavern.php. As long as it is a php file, you are free to name it whatever you would like.
The code above is just giving the template a name that WordPress can recognize later. This means that you can name it whatever you like. You should relate it to what you are going to use it for such as landingpage or archive.
The page you created can use all php markups that other pages can. Start out by calling the footer and header of WordPress. If you do not want to do this, you can always do the entire thing with HTML.
If your template does not have a header.php or you do not call it, add all the information for your header and do not forget the style.css.
Once you are done with this file, save it and upload the entire thing to the directory of your theme. This is going to be where your index.php is located.
The next step is to login to your WordPress admin area and click to add a new page. Because you have already added all the settings you want in the php file, you will just need to give the page a name and leave all the text blank. On the right hand side, find the attributes box and choose your template from the drop down menu.
Add your description, title, basically all your meta information. This page will use the template that you have chosen.
If you picked the option for the content to be shown as dynamic, adding the content from the admin panel is a must.
If you are using WordPress as a content management system then this tutorial can be a great place to start your customization.