Loading ...

2 Ways to Create Custom Single Post Template in WordPress

2 Ways to Create Custom Single Post Template in WordPress

brandngraves
by Brandon Graves — 1 year ago in Development 5 min. read
1924

Many people feel that using a readymade WordPress theme restricts them to that product’s pre-defined design. While this may be true to a certain extent, it is not that you cannot make any changes to your website according to your wishes.

In this guide, we are discussing ways to create a custom single post template post in WordPress. Some of you will be wondering why anyone would need a custom single post layout. Let’s say you want to highlight a single post or post type in the same category of your blog. Now in order to do this, you will have to apply changes to the styling or the content. Creating a custom single post allows you to define a design that can be applied to specific posts in the future as well. Let’s see how you can easily create such templates easily.

Related: – Top 5 best Benefits of WordPress Development for Business Sites

1. Creating A Custom Single Post Template Manually

First, we will see how you can create the custom layout manually through coding. This method will be suitable for people who possess technical knowledge and are familiar with WordPress customization and development. You can use the following steps to build the template manually.

i. Create Your Template’s File

People who are interested in using this process must ensure that they apply the changes to their website through a child theme. This will future-proof their modifications and ensure that they can use them anytime. We will now create a file for the new template. Use an editor to create an empty file and name it as new-template.php. Copy the code shown below and paste it in the file.

create custom single post template wp 1 - 2 Ways to Create Custom Single Post Template in WordPress

Here we have defined a new template which is also called “New Template”. You can insert your preferred name in the Template Name section. This layout can be used for posts and the header will be called through a hook. Now, this file is empty and therefore we will add the content of the existing single template file of your theme. Connect to your website through an FTP client and locate your child theme folder. In the folder, find the single.php file and open it.

create custom single post template wp 2 - 2 Ways to Create Custom Single Post Template in WordPress

Copy the code below the “get_header(); ?>” part. Now paste the copied code in your new-template.php file after “get_header(); ?>”. It will look like the code shown below.

create custom single post template wp 3 - 2 Ways to Create Custom Single Post Template in WordPress

You can make the changes to the code to define the appearance of the new layout. Save the file and move to the next step.

Related: – Are You Blogger, Do You Looking Out For A Fast And Secure Plugins Of WordPress?

ii. Upload The File To The Child Theme Folder

Access your child theme folder and upload the file to it through FTP. Open a post or page in your installation. In the Post Attributes meta box, you will find the new option “New Template” along with the Default Template. Your custom single post template is now successfully added to your installation.

create custom single post template wp 4 - 2 Ways to Create Custom Single Post Template in WordPress

2. Creating A Custom Single Post With A Page Builder

We will now build a custom single post template post in WordPress with a page builder. A page builder is a handy tool that allows users to create their layouts without any coding.

i. Install The Elementor Pro Plugin

The builder that we have chosen for this tutorial is called the Elementor Pro. An open-source version of this plugin is also available but the premium variant has the Theme Builder which we need for our purpose. You can purchase the product from its developer website. Then access your dashboard and go to Plugins > Add New. Press the Upload Plugin button to upload the zip file in which you received the tool. Activate it on your website and move to the next step.

ii. Add A New Template

Go to Elementor > My Templates in your control panel. Press the Add New Template link and you will be directed to another screen.

create custom single post template wp 5 - 2 Ways to Create Custom Single Post Template in WordPress

Here, in the Choose Template Type, select the Single option from the dropdown. If you want, you can enter a name for your layout as well. Hit the Create Template button.

create custom single post template wp 6 - 2 Ways to Create Custom Single Post Template in WordPress

iii. Select A Layout

The tool will now ask you to choose a layout for your template from some existing options. This is a handy feature for non-technical users who do not want to build everything from scratch. People who want to build a completely new design can close this window to generate the new layout. In this tutorial, we will choose an existing template. Hover the cursor over an option and then hit the Insert link.

create custom single post template wp 7 - 2 Ways to Create Custom Single Post Template in WordPress

iv. Modify The Template

Elementor will now open the selected layout in the editor. On the left-hand side, you will find widgets and content options. These items can be easily dragged and dropped on to the template on the right.

create custom single post template wp 8 - 2 Ways to Create Custom Single Post Template in WordPress

You can click on element to open its settings panel to modify each section of the page. Press the eye icon in the bottom part of the control panel. Choose Settings and include the Preview Settings option to your menu. You can use this feature to check the appearance of your layout.

create custom single post template wp 9 - 2 Ways to Create Custom Single Post Template in WordPress

v. Publish The Template

Once you have made all the changes, hit the Publish button. The plugin will now ask you to define the conditions to apply the layout.

create custom single post template wp 10 - 2 Ways to Create Custom Single Post Template in WordPress

Users enjoy the flexibility to determine the conditions according to their preferences. They can select the template to be used for individual posts or exclude items that contain certain tags.

create custom single post template wp 11 - 2 Ways to Create Custom Single Post Template in WordPress

Your custom single post is now ready and will be used according to your specified conditions.

Conclusion

WordPress’ open-source and popular nature means that you can access various resources to fulfill your requirements. If this tutorial seems too complex to you, then you can easily find a WordPress template customization specialist to build a custom post template for you.

 

Brandon Graves

Brandon Graves is a WordPress expert working with HireWPGeeks, a company that can be contacted to hire WordPress designers. He likes to explore different kinds of topics related to WordPress web development. Follow Brandon on Twitter to get updates about more valuable information.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Copyright © 2018-2020 The Next Tech. All Rights Reserved.