Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 16 of 426)

A Backend Engineer Learns to Build Block Editor Blocks, Part 5

Now that we’ve got the basics of the block built, it’s time to introduce some of the features afforded to us by the WordPress API that allow us to make changes to the visuals of our block. Namely, we want to using block attributes for custom colors.

Sure, up to this point, we’ve bee building the blocks using the WordPress APIs for block creation, serialization, and displaying, but we’ve also hard-coded a lot of our our styling. And when it comes to building custom blocks, sometimes that’s exactly what we want to do.

But other times, we want the users to be able to change, say, the color of their text or the background of their blocks, or maybe both. And the APIs for the Block Editor make this possible. As with the rest of the content of this series, though, it’s not without understanding what’s available to us.


Since this series builds upon itself, I recommend reading and following the previous articles thus far especially if you’re just now stumbling across this content.

So far, these are the things we’ve discussed:

  1. Required Tools, Plugin Structure, Dependencies, Block Metadata
  2. The Backend, The Frontend, Functionality, Styles, a Working Demo
  3. Block Attributes, Editable Content, Components, Editor Styles
  4. Saving Data, Styling the Frontend

If you’re ready to continue, we’ll get started. Remember, now that we’re this far in the series, I’m working to keep the articles a bit shorter. This is because:

  • We’ve laid enough ground work so it’s easier to focus on one thing at a time,
  • I find it easier to digest one concept at a time especially when it comes to learning something new, like building blocks as a backend engineer 🙂.

So in this post, we’re going to focus on one new thing: Introducing color options for our block.

Continue reading

On Social Media, WordPress, and Software

This year’s Thanksgiving Break was the first time that I didn’t write anything I was doing over the break. I’ve been doing so since 2012 so this would’ve been a decade of doing it.

Almost made it 🙃.

But there’s the thing:

  • As if it isn’t evident already, the frequency of my writing has decreased but the length of the articles has increased.
  • I’ve also changed the front-page of this site such that it displays more about what I’ve done in my career in software development and WordPress,
  • And it includes a list to my most recent articles.

Given a post this year would’ve been a consistent decade of writing a traditional holiday post and how that’s changed, I couldn’t help but think about how things have changed within the web development economy as well as the WordPress economy.

And no, this is not going to be a nostalgic, reflective post.

Continue reading

Working with Multiple User Metadata Queries

In one of the most recent issues of The Repository (which is a worth a subscribe), I said that one of the Twitter account I recommend following is @mattmedeiros. And though he and I never see eye to eye on anything 😏, I said:

I really like what [Matt’s] doing with The WP Minute. I think his commentary, perspective on business and the WordPress economy, and the type of journalism he’s doing is different from many others.

And I meant it.

As he’s working to grow the type of news that he’s covering, he’s also getting back to something that I think that’s either been missing, fragmented, or missing because it’s fragmented too much across the various ways we’re sharing information: WordPress tutorials.

Continue reading

A Backend Engineer Learns to Build Block Editor Blocks, Part 4

At this point, we’re half way through a major improvement to the block we’ve been working on. We have the ability to edit the content in the editor but we aren’t able to save it and because we aren’t able to save it, we aren’t able to view it on the frontend.

Now, though, we’re at a place where we can save our data, render it on the frontend, and continue to make sure that what the author sees is what the visitors see.


As I’ve done with the rest of the series, I recommend reading these first parts because they are going to bring you up to speed on everything you need to do to get up to this point:

  1. Required Tools, Plugin Structure, Dependencies, Block Metadata
  2. The Backend, The Frontend, Functionality, Styles, a Working Demo
  3. Block Attributes, Editable Content, Components, Editor Styles

Note that I still don’t have a GitHub repository set up for this plugin. I will once we reach a certain point, but not yet. And that’s because I think reading through the material and having to implement it versus cloning and changing a few things around can help you learn some of this material faster.

Anyway, I ended the previous post stating:

We’re going to cover

  • how to save the content,
  • render it on the frontend

And that will wrap up this initial part.

So that’s what we’re going to do.

Continue reading

A Backend Engineer Learns to Build Block Editor Blocks, Part 3

The first two articles in this series have been long. Not only long in terms of the content they cover, but long in comparison to the usual content I write. Part of this is because of the nature of what I’m trying to cover and part of it has to do with getting the basic plugin going.

We’re at a point now, though, where we can start to shorten the length of the article and focus more narrowly on the functionality and its implementation.


If you’re stumbling across this series and this is the first post you’re reading or you’ve not done any of the work prior to get everything off the ground yet (as I don’t have a GitHub repository set up for this plugin just yet – and that’s on purpose 🙂), here’s what’s been covered so far:

  1. Required Tools, Plugin Structure, Dependencies, Block Metadata
  2. The Backend, The Frontend, Functionality, Styles, a Working Demo

In the previous article, I stated:

In the next article, we’ll start talking about how we can edit text within the context of the Block Editor, how to save the changes, and then view them on the frontend.

Originally, I planned to cover the following in a single article:

  • convert the element in the block editor into a field we can edit,
  • save the content of the field,
  • render the content that’s above

Instead, I’m going to cover just the first point above so we can focuses solely on the editor and how to manipulate data within its context. Then we’ll follow the article up with how to save the content and render it on the frontend.

Continue reading
« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑