Post As Template Tutorial

WordPress Post to Template Tutorial

Adrienne Boswell

This is a tutorial on how to turn a WordPress post into a template using patterns for the Block editor.

Use a post for a template WordPress Patterns tutorial

This tutorial will not work for you if you are not using WordPress or you are using a page builder that does not support blocks and patterns.

Why Use a Template for WordPress Posts?

Whether you’re a seasoned blogger or just starting out, creating templates can streamline your workflow, maintain branding consistency, and save precious time. Let’s dive in!

You would want to use a template for your WordPress posts for several reasons. These are probably the most important:

1. Consistency

Templates ensure that each post has a consistent format, which is crucial for maintaining a professional and cohesive look throughout your site. This consistency helps reinforce your brand identity and make your blog more recognizable to readers.

2. Time-Saving

With a template, much of the groundwork is already laid out. You don’t have to start from scratch for each post, saving you valuable time. This allows you to focus more on the content than each post’s structure and design.

3. Improved Efficiency

Templates simplify the process of creating new posts. Providing a predefined structure helps streamline the workflow, making it easier for you or your team to generate content quickly and efficiently.

With that said, WordPress does not have a templating system other than the types of content, whether pages or posts. According to your theme, a post may have a sidebar, and a page may not, but that is as far as WordPress goes for templating. So what are the solutions?

Using a Plugin

Add a plugin to your site that allows you to duplicate a post. There are several available features. Some allow you only to duplicate posts or pages but no other custom post type.

The problem with this is that once you have duplicated a post, you still have to edit it to turn it into a new post. Using Quick Edit lets you quickly change the post title, author, categories, tags, publication date, and publication status. You probably want to change the content, so you must do a full edit.

Use Block Patterns

Hello, Block Patterns! With block patterns, you can save just about anything you want to reuse later. You can install plugins with their own patterns for page building.

To edit patterns, go to Appearance, then Patterns. WordPress already has some default patterns.

Making a template is pretty simple. Find a post you would like to use as a template, copy it, and paste it as a pattern, then use your new template in a post and Bob’s your uncle.

Step-by-Step Guide

This guide uses my recipe website, The Good Plate’s recipe for Homemade Mayonnaise. It’s quite good, so feel free to try the recipe.

Create the Template

  1. Select Your Starting Post: Choose an existing post that you want to use as a template. For this example, let’s use the “Homemade Mayonnaise” post.
  2. Access the Block Editor: Click “Edit” to open the block editor for your chosen post.
  3. Switch to Code Editor: Click the three dots in the upper right corner and select “Code Editor.”
  4. Copy the Relevant Code: In the area below the title (e.g., where it says wp:image), select the entire code snippet (Ctrl-A) and copy it (Ctrl-C).
  5. Create a New Pattern: Navigate to the WordPress dashboard. Under “Appearances,” click “Patterns.” Create a new pattern named “Recipe Template.”
  6. Disable Sync: Ensure that the “Synced” option is turned off.
  7. Paste the Code: In the pattern editor, paste the code snippet you copied earlier.
  8. Switch Back to Visual Editor: Exit the code editor (Ctrl-Shift-Alt M) and switch back to the visual editor.
  9. Customize Your Template: Edit the template by adding placeholders for dynamic content (e.g., recipe titles, ingredients, and instructions).
  10. Save Your Pattern: Don’t forget to save your pattern.

Using Your Template

  1. Start a New Post: Begin a new post in the block editor.
  2. Choose a Block: Click where it says “Type / to choose a block.”
  3. Access Patterns: Click the plus sign on the left-hand side and select “Patterns.”
  4. Select Your Custom Pattern: Under “My Patterns,” choose the “Recipe Template” you created.
  5. Edit and Fill In Details: Customize the template with specific content for your new post.

And there you have it! You’ve successfully turned a post into a reusable template. Happy blogging! 📝👩‍🍳


Feel free to adjust the content or add any additional details as needed. If you have any questions, don’t hesitate to reach out.

Why You Cannot Edit Your Template

There is a gotcha when doing this. The trick here is to make sure that your pattern is NOT synched. If a pattern is synched, you can only edit the original pattern; any editing you do will take you to the pattern itself.

WordPress post as template tutorial,
Do NOT sync

How to Un-Sync a WordPress Pattern

There is no way to un-sync a pattern; however, you can copy the pattern and create a new one that is not synced. I recommend using the code editor when you do this to make sure you get EVERYTHING. Then, paste the code into the new pattern. When you create an un-synced pattern, you can edit it to fit your heart’s content.

Don’t you just love WordPress? 😊

WordPress Post as a Template Transcription

Transcript

Good afternoon and welcome to the Good
Plates Kitchen.
Today I’m going to show you how to turn a
post into a template.
Doing this brings branding consistency,
saves time and improves efficiency.
Let’s get started.
The first thing you
want to do is you want to
find a post that you’d
like to use as a template.
In this case, I’m going to use my homemade
mayonnaise like best foods as my template.
So, you click on edit using the block
editor.
So, click on the three dots in the upper
right hand corner where it’s as options
and choose code editor.
Now, see?
This is what the actual code is.
Now, you want to copy all of this.
You can use Ctrl A to select all
and then Ctrl C will copy it. Okay.
Next thing you want to do is you want to
go to appearance and patterns.
You can leave the site.
As you can see, I already have a few
patterns created, including a template,
but we’re going to make a new one.
So, we’re going to click on add pattern.
Add new pattern rather.
Add new pattern.
Now, you see this where it says synced.
It’s really, really, really important to
make sure that it is not synced.
That way you’ll be able to edit your
template.
If you don’t do that, it’s a mess.
Okay.
So, we’re going to call
this recipe template. Okay.
And click on add.
If you want to, you could use categories.
I’m not going to.
Now, you should still be in code editor
version and that’s what we really want.
If not, you can go up here and change it.
Okay.
And then you’re going to paste it.
Ctrl V.
And there’s everything you have.
Now, you really do want to be able to see
what you’re doing.
at this point.
So, you want to go back into visual
editor.
You can click on
exit code editor or you
can, you can type,
control, shift, Alt M.
And that will put you into regular.
So, start editing over here.
Like I’m going to say, a good caption.
And then I’m going to take this here.
And I’m going to say, small description.
Notice I’m doing this in caps.
So, that’s wait.
That way I will know what that is.
It’ll be really obvious.
Okay.
Now, this text.
You can actually use this information on
the left hand side.
And you can click all the way down here.
In this case, because I’m
going to be using the WPRM
recipe, I’m going to delete
all this text right here.
Click on the three dots.
And say delete.
Now, this is where the recipe is.
You would be editing this information.
But you can leave it in here for now.
And this particular post also has a
transcript.
So, we’re going to keep that intact.
If you don’t usually have transcripts and
you don’t usually have videos and you
could remove that.
Okay.
And now, we’re going to save.
And I’m going to click here to open
navigation.
I’m going to click this arrow here.
That should take us back to the main menu.
You could see the recipe template is saved
here.
Yes. Okay. Now, make a new post.
Add new post.
And we’re going to add a title.
And click on patterns.
My patterns.
And choose the recipe template that you
just created.
Now, that’s in there.
And you can change it.
Add new pictures, whatever you want to do.
Do recipe, whatever you want to do.
And then publish your article as you wish.
Okay.
And that’s it.
And I hope this was helpful.
Thanks for joining me.
We’ll see you again next time on the
Good Plate.

About the author

Adrienne has been a web developer for over 20 years and enjoys sharing snippets of code she has written.

Leave a Comment