How to extend Gutenberg Cover Block past the Container

One of my favourite blocks in the current version of Gutenberg is the “Cover”. It’s perfect to break up content into sections using large full-width images. 

However, if your page template has a container, the cover will stay within that container and while it does look ok, you might want to stretch it past the container all the way to the edge of the browser window. 

It’s a common style of block I need to reproduce while transitioning a site from WPBakery Page Builder to Gutenberg (not something I can recommend yet but I think it’ll be a common thing people will do eventually). Moving away from the shortcode-laden output of WPBakery seems to be more future-proof than trying to live with it for the next few years. But that’s for another post. Let’s get started!

The "cover" block in WordPress' Gutenberg editor
the “cover” block in WordPress’ Gutenberg editor
Continue reading “How to extend Gutenberg Cover Block past the Container”

Syntax Highlighting in WordPress

After I tried out a few of the available plugins for syntax highlighting, I ended up with a DIY solution that I’m really happy with. 

The main part of it is PrismJS which is an excellent JS/CSS solution for the job. 

I was trying to avoid anything that’s not out-of-the-box or requires custom shortcodes and PrismJS not only looks great, it also is very simple to use with the Classic Editor as well as the current version of Gutenberg.

Continue reading “Syntax Highlighting in WordPress”

Remove WPBakery Page Builder (formerly Visual Composer) shortcodes from the Excerpt

I’ve had this issue on a site where we’re using WPBakery Page Builder and its built-in “Grid Builder” for showing a selection of pages. Within the Grid Builder, we’re outputting the page excerpt. 

This means that WordPress shows certain shortcodes (or some variations of them) within the excerpt:

Continue reading “Remove WPBakery Page Builder (formerly Visual Composer) shortcodes from the Excerpt”

Deleting Yoast SEO metadata for a Custom Post Type

I needed to delete 20.000+ rows in the wp_postmeta table which related to a Custom Post Type and Yoast SEO. The SQL I ended up using was this:

DELETE pm 
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.post_type LIKE '%CUSTOMPOSTTYPENAME%'
AND pm.meta_key LIKE '%_yoast_%'

IMPORTANT: Don’t try this at home. And backup your database! I’m not responsible for any case of data loss! 

WordPress: Must-Use Plugins?

A plugin that is uploaded to the “mu-plugins” folder is always activated by default and can not be accidentally deactivated by the user. It was originally created for multi-site blogs (as “multi-user” plugins that were active on all sites of a multi-site) but can now also be used for single sites.

MU-Plugins:

  • can not be deactivated
  • are always executed
  • can not use activation hooks
  • loaded before all other plugins (in alphabetical order)

Visit the documentation for more.