From the course: WordPress Content Blocks: Working with Themes

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add new style variations

Add new style variations - WordPress Tutorial

From the course: WordPress Content Blocks: Working with Themes

Start my 1-month free trial

Add new style variations

- [Instructor] Now that you've seen what style variations can do, I'm sure you're wondering if you can add your own style variations to existing blocks. The answer is, yes you can by extending the Block Editor itself, which means we have to write a tiny bit of JavaScript in our theme. You see, the Block Editor is a significant departure from the old way of doing things in WordPress, because it uses JavaScript instead of PHP for almost everything. To add new features like style variations, we therefore have to add new JavaScript configurations to the theme. Now, if that sounds daunting, fret not, my friend. Once you see what's involved, you'll also see, this is well within your skillset if you're used to working with WordPress themes. In this example, I want to add a lede style variation to the paragraph block, so an author can change the style of the first paragraph to something more eyecatching. Just to show you I'm not cheating, if I click on this paragraph block right now, you'll…

Contents