Templates can be just as useful for an individual post as they are for pages in WordPress. It gives you the opportunity to customize an individual piece of content when you want to keep the rest of the posts as they are. It is a great way to accentuate the content while giving the post a specific appeal for virtually any purpose.
Today, we’re going to show you how to create this individual template for your website. The best part is that it works with any theme.
Why would you need a template for a specific post?
Posts can be just as influential as landing pages when it comes to marketing the site. As a result, some developers want to give the specific post a more customized and unique look as opposed to the other content on the site. For instance, you can change font colors and layout design for that certain template.
Perhaps you want to give the content on the website a more unique presence. Separating the categories of the posts with specific background colors, fonts or other key elements gives the site a more custom appeal.
Post templates can also be used to separate layouts of specific authors as well. Each person writing content can have his or her own layout within the site. Fans could immediately know who created the post simply based on the aesthetics alone when visiting new content.
Creating a Template for an Individual Post
Please be aware that the following tutorial is for those who understand the basics of coding. Creating a template for individual posts will require knowledge of CSS, HTML and PHP.
For this tutorial, we’re going to use the Single Post Template plugin. This plugin is quite old, but it allows WordPress to look for other templates. Otherwise, the option may not become available. We’ve tested this plugin on version 4.7 of WordPress and it works flawlessly.
One of the reasons why we use this plugin as opposed to some of the others is because it is highly rated and has more than 20,000 active installs.
To get started creating a custom template:
Go to the plugins area of the WordPress admin panel on the left.
Add a new plugin and search for “Single Post Template.”
Install and activate the plugin.
Now, you’ll need to access the theme directory of your website. This is done by either using FTP programs such as FileZilla or through the File Manager in cPanel. In either case, you need to access the “/wp-content/themes/” directory and open the folder of the theme you are using.
Create a new file in the themes directory called, “NewPostTemplate.php.”
Click to edit this file and paste the following code:
Take note that the “New Post Template” can be anything you wish. However, this is the name the plugin uses when showing you templates in the edit screen of WordPress. Save the file within the theme’s folder.
Go back to WordPress and create a new post or edit an existing one.
Under the editing window in the post, you will see a new function for changing the template. This will have a drop down window and should already be set to default. Click this to open your options.
You will see the file you just created called, New Post Template. Once this is selected, WordPress will use the coding of the file to adjust the post when it’s published.
It’s as easy as that. However, far more can be done to customize the template even further. This is where coding knowledge comes into play. In the NewPostTemplate.php file you created, you can modify the code to do virtually anything a regular webpage can support. Some people will copy the code from the theme’s single.php file to get started.
You can build an unlimited number of themes for posts. Just remember to give the template a new name in the code of each to help identify them when writing posts in WordPress. Otherwise, you could be left with a long list of templates named the same without knowing which one to use.
Customizing the template is completely up to how you want it to appear. This is when your coding skills will be used. We can’t tell you how to go any further because that is up to you as the developer.
Other Plugins of Note
There are many plugins that can help modify the templates in WordPress posts. While some of them only affect the posts of the entire site, others add a bit of functionality for customization. Here are just a few of the ones we find engaging.
Post Custom Templates Lite
The Post Custom Templates Lite plugin is an amazing way to create a completely unique look and feel for any theme. Using a drag-and-drop interface, users can completely customize the post and move attributes around easily. For example, you can move the author byline to the top or change the featured image width. There are many options to choose from and it gives you a great deal of control for customizing content.
Template for Custom Post Types
Template for Custom Post Types is essentially the same kind of plugin we used in this tutorial. It adds the drop down box when creating a post allowing users to choose a template. However, it also requires files to be created and saved in the theme’s folder. One of the highlights to this plugin is that you can select custom templates for posts, pages and other content in WordPress. If you’re averse to using a four-year old plugin, this one is more current.
If you know how to manage shortcodes, using Custom Templates may be a way to create a unique look to a post without HTML coding or accessing files. This plugin installs a wide range of shortcodes that can be placed virtually anywhere within a post or page. You can change everything from the location of the post author to the number of comments that are shown. This requires a bit more patience when trying to place a large number of shortcodes, though.
Adding a custom appearance to a post can serve a variety of purposes. Whether you want to accentuate the content or simply want to add a new look and feel for an individual piece, it can all be done through coding. All it takes is a bit of patience and knowledge of HTML, PHP or CSS and you can deliver a completely unique aesthetic even if you’re using a popular website theme.
What kind of modifications have you made in WordPress code? How would you use a custom appearance on a post?