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.
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.
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.
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.
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.
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.
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.
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.
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.
Go to Elementor > My Templates in your control panel. Press the Add New Template link and you will be directed to another screen.
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.
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.
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.
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.
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.
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.
Your custom single post is now ready and will be used according to your specified conditions.
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.
Tuesday May 17, 2022
Tuesday April 26, 2022
Monday April 25, 2022
Saturday April 23, 2022
Wednesday April 20, 2022
Monday April 18, 2022
Tuesday April 5, 2022
Wednesday March 30, 2022
Wednesday March 23, 2022
Monday March 14, 2022