Thursday, July 23, 2020

Creating a Single Post Template in WordPress using The Block Editor

Creating a Single Post Template in WordPress using The Block Editor



This method does not really create a post template and is limited in flexibility. However, it is the easiest way to save your own single post layouts and then reuse them.

The default WordPress block editor comes with a built-in feature that allows you to save and reuse blocks. One such reusable block is called the Group block.

The group block basically allows you to put several blocks and entire post layouts into one group. You can then save this group block and reuse it in your other posts.

Let’s take a look at how to use the group block to save your custom post templates.

First, you need to create a new post in WordPress. After that, simply add a group block to the content area.

Add group block

Now you can start adding blocks into the group block to create a single post layout. You can add any blocks you want including columns, media and text, cover images, and more.

Add blocks to the group

Once you are satisfied with the layout you have created, you need to take your mouse up and select the group block. Click on the three-dot menu icon and then select the ‘Add to Reusable Blocks’ option.

Add reusable block

Next, you need to provide a name for the reusable block and then click on the Save button. WordPress will now save your reusable block including all the blocks inside the group block.

You can then edit any existing post on your website or create a new one. On the post edit screen, simply click on the add new block button and look for your saved block under reusable blocks.

Reuse block

Add the block to your post and WordPress will load your entire group block with all the blocks and settings as you saved them.

This method allows you to save your custom layouts. However, it does not allow you to change how your theme handles single posts.

If you would like greater flexibility then continue reading.

Creating a Custom Single Post Template in WordPress Using Beaver Builder
The easiest way to create a custom single post template is by using Beaver Builder. It is the best WordPress page builder plugin on the market and allows you to create a post template without writing any code or modify your WordPress theme.

The first thing you need to do is install and activate the Beaver Builder plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Beaver Builder page and switch to the license tab to enter your license key.

Beaver Builder license key

You can find this information under your account on the Beaver Builder website.

By default, Beaver Builder is enabled for Pages in WordPress. You need to make it available for posts as well.

To do that, switch to the Post Types tab under Settings » Beaver Builder page. From here you need to check the box next to the ‘Posts’ option.

Enable Beaver Builder for posts

Don’t forget to click on the ‘Save Post Types’ button to store your changes.

Now that everything is set up let’s create a custom post template.

Simply create a new post in WordPress and on the post edit screen click on the ‘Launch Beaver Builder’ button.

Launch Beaver Builder

This will open the Beaver Builder interface with a live preview of your website. You can start adding modules and rows to your existing layout by clicking on the Add button at the top right corner of the screen.

You can also select a template as a starter point. There is even a blank template to give you clean slate to begin with.

Select a Beaver Builder template

Once you have chosen a template, you can edit it by simple point and click. You can also add rows and columns and fill them with modules and elements to create your custom layout template.

Adding Beaver Builder modules

Feel free to experiment with different modules and play around with their settings.

Once you have created something that you would like to use as your post template. It is time to save it.

Beaver Builder allows you to save your layouts as a template and then reuse them with other posts. Simply click on the menu at the top-right corner of the screen and select Save Template.

Save your custom Beaver Builder post template

You’ll be asked to provide a name for your template. After that click on the Save button to store it.

Name and save the template

Now, let’s see how to use this custom post template when creating posts.

Simply edit a post or create a new one and then launch the Beaver Builder to edit the post.

Next, you need to click on the Add button at the top right corner of the screen and then switch to the Templates tab. From here you need to select ‘Saved Templates’ from the Group dropdown menu.

Load your custom template

Beaver Builder will now load your saved custom layout and you can then start adding content for your new article.

Using Theme Settings for Custom Single Post Layouts
Many popular WordPress themes come with built-in settings to customize the appearance of your single post template.

If your theme supports these settings, then you’ll be able to find them on the post edit screen. The options available may change depending on the theme you are using.

For instance, this is how the Astra theme offers customization options when editing a single post.

Astra theme single post template customization

Using these options, you can change sidebars, hide headers, title, menus, and more.

On the other hand, many of the top WordPress themes come with ready-to-use templates that you can use.

If your theme includes single post templates, then you will find them under the Post Attributes tab while editing a post.

Choosing a template when writing a single post

These templates are complete layouts that you can use.

Manually Creating Custom Single Post Templates in WordPress
This method is a bit advanced as it requires you to edit theme files, copy and paste code, and optionally add custom CSS.

First, you need to open a plain text editor on your computer like Notepad and paste the following code inside it:




You can find this information under your account on the Beaver Builder website.

By default, Beaver Builder is enabled for Pages in WordPress. You need to make it available for posts as well.

To do that, switch to the Post Types tab under Settings » Beaver Builder page. From here you need to check the box next to the ‘Posts’ option.








No comments:

Post a Comment

The latest tech news about the world's best (and sometimes worst) hardware, apps, and much more. From top companies like Google and Apple to tiny startups ...