Pinegrow Countdown: Day 4 – WordPress Blocks and Themes
Pinegrow Countdown: Day 4 – WordPress Blocks and Themes
When you start a new WordPress project in Pinegrow, one of the first things you’ll need to decide is whether you will create a Block Plugin or a complete theme. In this video, I’ll help you understand their differences so you can start on the right foot.
Let’s start by looking at the official best practices published by WordPress. They say that a theme should control the presentation of the content, and a plugin should control the behavior and features. That’s great in theory, but it gets a little murkier in practice. If we followed that guideline in its strictest sense, we would have a theme with just page templates and CSS, then one or more plugins to add blocks and control functionality.
This probably doesn’t help with your decision, but it does provide some context. The real driver behind your decision will be where you are coming from and where you want to go.
Pinegrow’s Documentation
If you look at Pinegrow’s documentation site, you’ll see that they have a page that attempts to help you decide. They say that the simplest approach is to create a theme, if you want to reuse a block, you should create a plugin, or you can mix and match them to meet your needs. In my opinion, this is an overly simple and somewhat misleading explanation.
For example, Pinegrow says that creating a theme is the simplest approach. However, anyone who has ever created a theme knows that there is nothing simple about it. Even with all the helpers and logic that Pinegrow provides, creating a theme requires some conceptual knowledge of the WordPress template hierarchy and the key functions. On top of that, creating a theme involves a bit of planning and forethought so that everything is structured properly and flexible enough to handle your needs as they evolve.
That’s not to say that I don’t think you should create a theme; I’m just saying that it probably isn’t the right decision for the first-time Pinegrow user. Unless you have a firm grasp on creating WordPress themes and using Pinegrow, you might find that theme projects lead to frustration, frustration leads to anger, and anger leads to throwing your computer out the window.
Block Plugins
A block plugin is a great option for simply creating blocks that you’ll use inside the Gutenberg editor. These can be used for posts, pages, or even page builder pages with a Gutenberg content section defined. The biggest downside to creating block plugins is that Framework styles, such as Bootstrap or Tailwind, might have some unintended side effects. For example, Tailwind’s pre-flight reset could screw up the styling on any pages where you’ve used your block. Or, non-scoped styles in your blocks might step on the styling of other components. Then, there is the possibility that your blocks might not look exactly how you intend in the Block Editor because those stylesheets are controlled by your theme.
Something else I’ll point out, since this question has come up a few times, is that there isn’t a 1-to-1 relationship between blocks and plugins. That would be silly. You can create a single Block Plugin with one or one hundred blocks inside of it. In some cases, it might be worthwhile grouping blocks together into separate plugins, while at other times, you might want to create a single plugin to hold them all.
Scenarios
Now, I’ll walk you through a few scenarios and what I might recommend for each one.
Maybe you already have a website built that you are happy with, and you want to create a few custom blocks for specific purposes. Obviously, in that case, you’d create a block plugin project so you can enable the block and use it along what you already have. This works beautifully whether you are using Gutenberg or Page Builders. Most page builders allow you to add “inner content” sections or the equivalent, which allows you to create content inside Gutenberg and show it on your page builder page.
Next, once you fall madly deeply in love with Pinegrow, you’ll realize that you want to migrate your site away from whatever you are using today and rebuild it with Pinegrow. Again, this is a great time to start with a block plugin. You can take your existing blocks or page builder pages and replace them one by one with your Pinegrow-made blocks. Then, when you are ready, you can rip out whatever theme or page builder you are using and replace it with a theme you’ll create inside Pinegrow. I’ve gone through this process many times, and I love how it lets me incrementally switch over to Pinegrow.
Then, there is the case of a complete rebuild. Here, you have a few options. The obvious option to recommend is to create a WordPress theme using Pinegrow. That leads to a host of other questions, though. Do you include your blocks with your theme, or do you create them as a separate plugin? Do you create all new blocks or reuse the ones you may have built previously? Will you exclusively use Pinegrow-made blocks, or will you combine them with other block plugins such as Kadence or Generate Blocks? Or, will you simply use another off-the-shelf theme for your foundation and build your pages using custom block plugins? So many of these factors will be unique to you and your projects, so I don’t have much guidance here other than for you to think through your goals and plan before you start.
Wrap-up
If all this sounds like I’m advocating for new users to start by creating Block Plugins, it’s because I am. Block plugins give you the most flexibility for integrating with your current site and for future-proofing your website since they are self-contained and don’t have any dependencies. Plus, they are the foundational elements of your page regardless of what you chose to do with your theme.
A lot of page builder users will want to dive in and start by creating a theme, but I’m going to caution against that until you get at least a few blocks under your belt. Besides, you can always use your block plugins and themes together or move your blocks into a theme later once you have more experience.
I’m sure there are plenty more considerations I didn’t cover in this video, but hopefully, this gives you a good starting point. In tomorrow’s video, I’ll cover the differences between the main frameworks inside Pinegrow, some of the pros and cons of each, and some reasons why you might want to forego a framework altogether.
Make sure you are subscribed to my channel and Pinegrow’s YouTube channel for more information.
Recent Posts
About the Recent WordPress Drama
As many of you have heard, there is some drama in the WordPress space right now. If you haven’t heard anything yet, consider yourself lucky to have avoided the needless drama so far. In this post, I’ll cover what is happening, who is impacted, why it’s important, how we are protecting you, and some thoughts […]
Using Sass with Pinegrow
I recently had someone ask whether Pinegrow supports Sass, so I thought I’d do a quick video demonstration. In this demo, I show you how we activate our Sass stylesheet and how we can use a simple Sass variable to change the color of a heading.
Pinegrow Countdown: Day 1 – Pinegrow Plays Nice with Others
A lot of products in the WordPress space have grown in popularity, primarily because of their open and flexible ecosystem that allows 3rd party developers to create add-ons, extensions, and libraries. Pinegrow also has a great plugin API. But I’m going to show you in this video, that in most cases, you don’t even need it.
Pinegrow Countdown: Day 2 – Pinegrow is STILL not a Page Builder
In this video, I’m going to show you why Pinegrow is different from Page Builders so you don’t fall into the trap of trying to use it like something it’s not, only to get frustrated and give up.
Pinegrow Countdown: Day 3 – Frameworks in Pinegrow
Pinegrow has built some fantastic helpers for popular frameworks. In fact, when you start a new project in either Pinegrow Desktop or the Pinegrow WordPress plugin, you’ll be asked which framework you want to choose. If you are already used to using one of the built-in frameworks, the choice will be easy. If not, this little video will hopefully help you understand what the frameworks do and how you should answer those important initial questions.