Are you using the Block Lab WordPress plugin, but need the Wide and Full align buttons on your custom Gutenberg blocks?  These code snippets will add this missing feature.

The Big Missing Feature in Block Lab

When I started my last WordPress project, I was going the route of creating custom Gutenberg blocks.  I first settled on the plugin called Block Lab.

Block Lab worked great at first, allowing me to easily create new blocks within WordPress and then I would create the corresponding block PHP file for each one which would be used to render it.

Then, I ran into a problem.  I noticed a big missing feature in the Block Lab plugin.

Block Lab was missing the align buttons to make the block justify to the left, center, right, or stretch to wide or full width.

For this project, this feature was a must-have and a deal-breaker.

So, because I wanted to avoid having to redo all my blocks using a different plugin, I did a lot of research to figure out if I could customize it to add the feature.

After much research and trial & error, I finally came to a solution!

I implemented this solution in the form of a plugin, so go ahead and make a new plugin.  If you haven’t done it before, don’t worry, it’s not hard.

Let’s Fix It With a Custom Plugin

Note: You will need to have access to the files on your website.  So, if you’re not a developer who already has a killer local WordPress development setup, then you’ll need to use FTP or a file manager in your hosting company’s control panel.

Create a new folder under /wp-content/plugins/ and name it something like block-lab-wide-full-align.

Inside the folder, create a PHP file and name it using the same name as the folder, like block-lab-wide-full-align.php.  Copy and paste the following code into it…

Now, create a javascript file in that same folder and name it block_lab_align_filter.js.  Copy and paste the following code into it…

With both of those files saved in your new plugin folder, visit the Plugins page in your WordPress admin area, and you should see a new plugin called Block Lab – Add Wide and Full Align.

Activate that new plugin.  That’s it!  You should now see the wide and full align buttons on your custom Block Lab blocks!

Leave a Reply

avatar
  Subscribe  
Notify of