The best way to Create Customized Unmarried Publish Templates in WordPress

by | Sep 1, 2022 | Etcetera | 0 comments

Do you need to create a custom designed single post template in WordPress?

Custom designed single post templates will permit you to use different layouts in your individual blog posts. Many WordPress subjects come with a few different internet web page templates, and also you’ll be capable to moreover create your own if sought after.

In this article, we’ll show you merely create custom designed single post templates in WordPress. We’ll proportion multiple methods, so that you’ll be in a position to choose one that works highest in your needs.

How to Create Custom Single Post Templates in WordPress

When Do You Desire a Custom designed Single Put up Template?

Once in a while you may have regarded as attempting a unique feel and look for certain posts in your WordPress web page. For instance, it’s conceivable you’ll want to use a unique structure for featured articles or stories in a decided on magnificence.

That’s the position you need a custom designed single post template in WordPress.

Thru default, WordPress uses the only post template in keeping with the WordPress template hierarchy. All subjects come with a single.php template, and that’s used by default for all your single posts.

Some subjects may also include additional templates or structure choices that you simply’ll be capable to use.

It is extremely identical to making a customized web page template. Most WordPress subjects moreover come with internet web page templates that you simply’ll be capable to use while enhancing a post or internet web page in WordPress.

Choosing a Page Template

Having said that, let’s take a look at merely create custom designed single post templates in WordPress. We’ll show you multiple methods, so that you’ll be capable to use the one who works best for you.

Rising Single Put up Templates Using the Block Editor

This method does not in reality create a post template and is limited in flexibility. On the other hand, it’s one of the simplest ways to save some 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 the group block.

The group block lets you put various blocks and entire post layouts into one staff. You’ll then save this staff block and reuse it in your other posts.

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

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

Add Group Block

Now you’ll be capable to get began together with blocks into the group block to create a single post structure in your WordPress weblog.

You’ll add any blocks you need at the side of columns, media and text, cover footage, and additional.

Add Blocks to the Group

Once you’re pleased with the structure you’ll have created, you need to take your mouse up and make a selection the group block.

Simply click on on on the three-dot menu icon and then make a selection the ‘Add to Reusable blocks’ selection.

Add Reusable Block

Next, you need to offer a name for the reusable block and then click on on on the Save button. WordPress will now save your reusable block at the side of all the blocks inside the staff block.

You’ll then edit any present post in your internet web page or create a brand spanking new one. On the post edit show, simply click on on on the add new block button and seek for your saved block beneath the ‘Reusable’ tab.

Reuse Block

Add the block in your post and WordPress will load your whole staff block with all the blocks and settings as you saved them.

This method lets you save your custom designed layouts. On the other hand, it does not will permit you to alternate how your theme handles single posts.

If you wish to have higher flexibility, then continue learning the next step.

Rising Custom designed Single Put up Templates Using SeedProd

One of the vital most simple tactics to create a custom designed single post template is by means of the usage of SeedProd. It’s the best WordPress internet web page builder plugin and can create shocking internet web page layouts and custom designed templates without writing any code.

See also  9 Best WordPress Restaurant Plugins for 2023

You’ll use SeedProd’s drag-and-drop builder to create a fully custom designed WordPress theme, at the side of custom designed single post templates.

The first thing you need to do is ready up and switch at the SeedProd plugin. For added details, see our step by step data on methods to set up a WordPress plugin.

Upon activation, you need to enter your license key. You’ll to search out this knowledge beneath your account on the SeedProd internet web page.

SeedProd license key

After that, it’s time to create a custom designed WordPress theme. This is much more efficient than it sounds.

Creating a Custom designed WordPress Theme

First, you need to transport over to the SeedProd » Theme Builder internet web page. Proper right here, you’ll use surely one among SeedProd’s ready-made subjects as a kick off point. This will likely most probably alternate your present WordPress theme with a brand spanking new, custom designed design.

You’ll do that by means of clicking the ‘Topic issues’ button.

Create your custom theme

You’ll be confirmed an inventory of professionally designed subjects which will also be designed for various kinds of internet pages. As an example, there are templates referred to as ‘Trendy Trade’, ‘Promoting Corporate’, and ‘Mortgage Broker Theme’.

Take a look all through the decisions and make a selection one that highest suits your needs by means of clicking the checkmark icon.

Select a Theme That Matches Your Needs

Upon getting decided on a theme, SeedProd will generate all the theme templates you need, at the side of one for single pages and a few different for single posts.

Each template comes organize with sexy layouts and placeholder content material subject material that’s easy to customize.

SeedProd Creates All the Templates You Need for Your Theme

To learn further about creating a theme with SeedProd, see our data on methods to simply create a customized WordPress theme with none code.

Customizing the Default Single Put up Template

SeedProd makes it easy to customize the default ‘Single Put up’ template the usage of a drag and drop internet web page builder.

Simply click on at the ‘Edit Design’ link found out beneath the template. This will likely most probably open your post template in SeedProd’s visual editor.

Click the 'Edit Design' Link Under the Single Post Template

SeedProd’s visual editor has a 2 column structure. On the left, you’ll to search out blocks and sections that you simply’ll be capable to add in your design. And at the right kind is a preview of the template where you’ll be capable to see your changes in real-time.

SeedProd Visual Editor Blocks and Sections

It’s moreover easy to customize the structure of your post template. Simply click on on on any block to look its settings inside the left column.

As an example, must you click on on on the post establish, then you definately definately’ll be capable to see its settings. Now you’ll be capable to alternate the alignment, font size, heading level, and additional.

Click on a Block to Change Its Settings

Clicking the Difficult tab permits you to alternate font colors, spacing, and differing types.

You’ll add additional blocks by means of dragging them from the left column into the preview column. SeedProd uses template tags to tug in dynamic content material subject material like post titles, featured footage, comments, and additional. This allows you to add content material subject material to the template with out a want to edit each and every post in my view.

As an example, you’ll be capable to add a Posts block at the end of your post content material subject material. This will likely most probably display fresh posts that your visitors would possibly want to be informed after they finish the existing post. This block it will likely be confirmed robotically on all posts the usage of this template.

Add a Posts Block to the Bottom of Your Single Posts Template

Next, you’ll be capable to alternate the settings of the Posts block to customize the content material subject material that is confirmed.

As an example, you’ll be capable to display content material subject material from specific categories, use a two-column structure, and change the selection of posts which will also be confirmed.

SeedProd Posts Block Settings

Be at liberty to spend time experimenting with different blocks and exploring their settings.

After creating something you’d like to use as your post template, it’s time to save it by means of clicking the fairway ‘Save’ button inside of essentially the most smart correct corner. After that, you’ll be capable to close the SeedProd visual editor by means of clicking the ‘X’ close icon.

When You're Finished, Save the Single Post Template

You’ll customize the rest of your WordPress theme within the equivalent way. But if you need just a little help, then refer once more to our step-by-step data on methods to create a customized WordPress theme with SeedProd.

While you’re proud of how the whole thing turns out, be sure that the ‘Allow SeedProd Theme’ switch is toggled to the on position. Your WordPress internet web page will now use your SeedProd theme and custom designed single post template.

Enable the SeedProd Theme

Using Theme Settings to Create Custom designed Single Put up Layouts

Many same old WordPress subjects come with built-in settings to customize the appearance of your single post template.

If your theme is helping the ones settings, then you definately definately’ll be capable to to search out them on the post edit show. The decisions available would possibly alternate depending on the theme you’re the usage of.

For instance, the Astra theme provides customization alternatives when enhancing a single post. Using the ones alternatives, you’ll be capable to alternate sidebars, cover headers, establish, menus, and additional.

See also  Crafting Your Content material Blueprint for the Remainder of 2023 With Author Trendy Millie
Astra Theme Single Post Template Customization

Alternatively, many of the most sensible WordPress topics come with ready-to-use templates that you simply’ll be capable to use.

If your theme contains single post templates, then you definately’re going to to search out them beneath the ‘Template’ or ‘Put up Attributes’ panel while enhancing a post.

Choosing a Template When Writing a Single Post

The ones templates are whole layouts that you simply’ll be capable to use and not using a configuration required.

Manually Rising Custom designed Single Put up Templates With Code

This method is a bit of advanced as it calls so that you can edit theme data, reproduction and paste code, and optionally add custom designed CSS. Must you haven’t completed this previous than, then check out our tutorial on methods to replica and paste code in WordPress.

First, you need to open a certain text editor in your laptop like Notepad and paste the following code within it:


This code defines a brand spanking new template referred to as ‘Featured Article’ and makes it available for post, internet web page, and product submit varieties.

You will have to save this report as wpb-single-post.php in your desktop. Next, you need so that you can upload the template in your WordPress internet web page. To try this, you need to use an FTP shopper so as to add the report in your provide theme folder.

Now you’ll be capable to log in in your WordPress admin area and create or edit a post. Scroll down just a little on the post edit show, and also you’re going to appreciate a brand spanking new ‘Template’ panel or ‘Put up Attributes’ meta box with an selection to select the template.

Select Your Custom Post Template

You’ll see your ‘Featured Article’ custom designed template listed there.

At the moment your template is in large part empty so settling on it’s going to simply display a white show.

Let’s restore this.

One of the vital most simple tactics to do that is by means of copying the code from your theme’s single.php report and the usage of it as a kick off point. You’ll will have to open the only.php report and then reproduction the whole thing after the get_header() line.

Next, you need to stay this code at the end of your wpb-single-post.php report. Now you’ll be capable to save this report and upload it once more in your server.

On the other hand, this may occasionally most probably look exactly the equivalent as your provide single post template. You’ll now get began making changes in your custom designed single post template.

You’ll add your own customized CSS classes, take away sidebars, create a complete width template, or anything you need.

Rising Custom designed Single Put up Templates by means of Magnificence

Do you need to use a custom designed single post template in keeping with categories? As an example, you’ll be capable to give posts inside the adventure magnificence a unique structure to posts inside the footage magnificence.

You’ll do that the usage of each the SeedProd Theme Builder or code.

Rising Custom designed Single Put up Templates by means of Magnificence Using SeedProd

Earlier we covered customize the SeedProd Theme Builder’s default single post template. Alternatively it doesn’t prevent there. With SeedProd you’ll be capable to add as many custom designed post templates as you prefer, comparable to a unique structure for each and every post magnificence.

So that you can upload a brand spanking new single post template, merely click on at the ‘Replica’ link beneath the original post template. A brand spanking new template referred to as ‘Single Put up – Replica’ it will likely be created and added to the perfect of the theme templates internet web page.

Create a New Post Template by Duplicating the Default Post Template

You’ll customize the new template within the equivalent way you customized the default Single Put up template earlier. Simply click on at the template’s ‘Edit Design’ link and make any changes you prefer the usage of SeedProd’s visual editor.

While you’ve finished customizing the template, it is important to add some necessities so that SeedProd will know which posts will have to use this template. In this case, we’d love it displayed when viewing posts within a single magnificence.

Click the 'Edit Conditions' Link

You’ll do that by means of clicking the template’s ‘Edit Conditions’ link and a brand spanking new window will pop up.

Proper right here you’ll be capable to give the template a name and priority. The default Single Put up template has a priority of 0, so that you’ll wish to give this template a greater priority so it’s going to be displayed on matching categories.

Add Conditions to Display the Template for a Certain Category

Underneath ‘Conditions’, make a selection ‘Has Magnificence’ from the second drop down menu, then kind the identify of the category inside the last field. As an example, must you very best want posts from the images magnificence to use this structure, then kind ‘footage’.

While you’re finished, click on at the ‘Save’ button and now this template it will likely be used for all posts inside the matching magnificence.

This is one of the simplest ways to create multiple custom designed post templates in WordPress. It doesn’t require any knowledge of code and gained’t accidentally mess up any theme data.

Rising Custom designed Single Put up Templates by means of Magnificence Using Code

See also  Promoting Metrics: How one can Monitor Have an effect on for Sustainable Trade Enlargement

This is another manner for many who are comfortable together with code to their theme data.

First, you need so that you can upload this code in your theme’s purposes.php report or a code snippets plugin.

/*
* Define a continuing path to our single template folder
*/
define(SINGLE_PATH, TEMPLATEPATH . '/single');
 
/**
* Clear out the single_template with our custom designed function
*/
add_filter('single_template', 'my_single_template');
 
/**
* Single template function which is in a position to choose our template
*/
function my_single_template($single) {
global $wp_query, $post;
 
/**
* Checks for single template by means of magnificence
* Check out by means of magnificence slug and ID
*/
foreach((array)get_the_category() as $cat) :
 
if(file_exists(SINGLE_PATH . '/single-cat-' . $cat->slug . '.php'))
return SINGLE_PATH . '/single-cat-' . $cat->slug . '.php';
 
elseif(file_exists(SINGLE_PATH . '/single-cat-' . $cat->term_id . '.php'))
return SINGLE_PATH . '/single-cat-' . $cat->term_id . '.php';
 
endforeach;
}

This code first checks to look if WordPress is calling for a single post. If it is, then it tells WordPress to seek for the template inside the /single/ folder of your WordPress theme.

Now you need so that you can upload template data defined by means of this code.

Connect in your WordPress internet hosting the usage of an FTP client or Document Manager in cPanel and transfer to /wp-content/subjects/your-theme-folder/.

Within your provide theme folder, you need to create a brand spanking new folder referred to as ‘single’. Next, you need to open this folder and create a brand spanking new report within it. Transfer ahead and identify this report single-cat-{category-slug}. Exchange {category-slug} in conjunction with your precise magnificence slug.

As an example, you probably have a category referred to as ‘Data’, then you definately’re going to create single-cat-news.php report. In case you have a category referred to as ‘Shuttle Tips’, then create a template single-cat-travel-tips.php, and so on.

Creating Single Post Template for Categories

Now, the ones template data it will likely be completely empty. As a kick off point, you’ll be capable to reproduction the contents of your single.php report from your theme folder and paste them within each and every of the ones templates. After that, you’ll want to edit the ones templates to make your desired changes.

In case you’re completed, you’ll be capable to transfer in your internet web page and have a look at a post. It’ll use the template that you simply’ve were given created for the category where this post is filed.

Now let’s suppose you’ll have a post filed in two categories Data and Shuttle Tips. WordPress will robotically show the template for ‘Data’ on account of it kind of feels that first in alphabetical order.

Alternatively, must you filed a post in a category and didn’t create a template for that magnificence, then WordPress will fall once more to the default single.php template of your theme.

Rising Custom designed Single Put up Templates for Specific Authors

Let’s suppose you need posts written by means of a selected creator to seem different in your internet web page. You’ll do that the usage of code by means of following the equivalent technique we showed for categories.

First, you need so that you can upload this code in your theme’s purposes.php report or a code snippets plugin.

/**
* Define a continuing path to our single template folder
*/
define(SINGLE_PATH, TEMPLATEPATH . '/single');
 
/**
* Clear out the single_template with our custom designed function
*/
add_filter('single_template', 'my_single_author_template');
 
/**
* Single template function which is in a position to choose our template
*/
function my_single_author_template($single) {
global $wp_query, $post;
 
/**
* Checks for single template by means of creator
* Check out by means of individual nicename and ID
*/
$curauth = get_userdata($wp_query->post->post_author);
 
if(file_exists(SINGLE_PATH . '/single-author-' . $curauth->user_nicename . '.php'))
return SINGLE_PATH . '/single-author-' . $curauth->user_nicename . '.php';
 
elseif(file_exists(SINGLE_PATH . '/single-author-' . $curauth->ID . '.php'))
return SINGLE_PATH . '/single-author-' . $curauth->ID . '.php';
 
}

Next, you will have to connect in your internet web page the usage of FTP or cPanel report manager in cPanel and then transfer to /wp-content/subjects/your-theme-folder/. Must you haven’t already created a folder referred to as /single/ within it, then transfer ahead and create it now.

Within this folder, you need to create a template the usage of the creator’s username inside the template identify. As an example, single-author-johnsmith.php.

This template it will likely be empty, so that you’ll be capable to reproduction and paste the contents of your theme’s single.php template and use it as a kick off point.

You’ll now talk over with your internet web page to view a post created by means of a selected creator. It’ll use the template you created.

We hope this article helped you learn how to create custom designed single post templates in WordPress. You might also want to be informed methods to monitor web page guests on your WordPress web page, or see our tick list of will have to have WordPress plugins to develop your web page.

Must you preferred this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You’ll moreover to search out us on Twitter and Fb.

The post The best way to Create Customized Unmarried Publish Templates in WordPress first seemed on WPBeginner.

WordPress Maintenance

[ continue ]

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!