My Blogging Project: Creating a Child Theme

the word blog repeated around a globe

Over the last couple of months I’ve been learning to code, partly just for the sake of something to learn, but also partly for the sake of developing a child theme for my blog. In this post, I’ll talk a bit about how the child theme creation process is going, but to start off, what the heck is a child theme?

Every WordPress blog has a theme. Themes are layered on top of the WordPress core and influence the design of your site, both in terms of how it looks when other people are looking at it and how it looks to you in the editor. A child theme is layered on top of a parent theme to further influence how a site looks and behaves. The reason for creating a child theme rather than just tweaking the parent theme directly is that each time a new update of the parent theme is released, any modifications that an individual user had been made to the previous version of the parent theme are lost. Because a child theme sits on top of a parent theme, it keeps on doing its thing even if the parent underneath it has updated.

Another way of customizing WordPress sites is adding plugins (although most plans don’t let you do that). These add extra functionality. Since the child theme I’m building is just for me rather than being created for other people to be able to use, I’m actually focusing more on functionality than presentation, but it’s easier to do things all in one place in the child theme than to create a plugin as well.

My child theme

Today was the first time trying out the child theme on my actual site. Up until now, I’ve just been working on it using a test site that only runs on my computer. My child theme changes a few things behind the scenes, including incorporating some functionality that I’ll no longer need to use plugins for. It changes very little about the way my site looks, though, because I’m using the same code for that kind of thing as I had already been using as custom CSS (Cascading Style Sheets) code in my parent theme (which is Astra).

One thing I’ve added is making an author bio appear at the bottom of posts, but only on specific post categories and only on the site itself rather than in the RSS feed, which is what’s displayed in feed readers like the WordPress Reader. I’m not actually changing the content of the posts themselves, but tacking an extra bit of code on right when a post is being displayed. I felt rather pleased with myself when I got that working.

Speaking of the RSS feed, I have my Amazon author profile set up to display my blog feed, but there are certain categories of posts that I’d rather not have displayed there. To address this, I used my child theme to create a custom RSS feed in addition to the feed WP automatically creates for my site, and my custom feed filters out posts from specific categories.

I had things working with a feed reader I found that could display feeds created by a local site that wasn’t actually on the internet… or at least, it was working the last time I had tested it. Somehow, I managed to break it since then without realizing it. Anyway, when I uploaded the child theme to my live site, not only did the custom RSS feed not work, but it managed to break my regular feed as well. I’ve disabled the custom RSS feed until I can figure out how I managed to fuck it up, and I think I’ve unbroken the regular feed, but it’s a toss-up whether this post will appear in the WP Reader.

Work in progress: custom blocks

I’ve been using a plugin that was called Ultimate Add-Ons for Gutenberg that includes a number of different types of blocks above and beyond the standard block types available in WordPress (like a table of contents block I use on several of my site”s pages). The plugin-maker has recently totally overhauled the plugin and the overhauled version is a bit of a disaster, so I decided to try to use my child theme to create the block types I want to be able to use rather than having to use the plugin. I took a LinkedIn Learning course to learn how to create custom blocks, and now I’m in the process of trying to build a table of contents block.

If you think the block editor is a pain in the ass to use, blocks are even more of a pain in the ass to code. A lot of WordPress stuff is coded using the PHP language, but building Gutenberg blocks involves a different language (JavaScript), plus some other stuff on top of that (React and npm).

So far, I’ve got my basic custom block created and I can use use it in posts just like any other kind of block. Now I’m working on the hard part, which is getting it to generate a functioning table of contents on the fly using the headings in a post.

So that’s a bit of an update on what I’m working on. I know this is something the vast majority of people will have less-than-zero interest in doing for their own site, but I’m finding it kind of fun to tinker around with WordPress nuts and bolts.

Blogging toolbox: graphics of toolbox and wordpress logo

The blogging toolbox series has tips to support you in your blogging journey. It includes these posts:

33 thoughts on “My Blogging Project: Creating a Child Theme”

  1. Wow! Great adventures in coding, Ashley Leia. I like your addition of the Author’s Bio on your main flagship page. Looks great! The layout seems different to me on your main page too. But then again, I usually read your posts through the WP reader/notifier you may have changed your front page layout ages ago.

  2. I took a coding course once. I liked the “coding for kindergarteners” unit best. Wll done on learning such an amazing new skill. How neat to be able to have such control over your site.
    I have to admit, when you’d previously referenced a child-theme, I thought it had something to do with kiddos.

  3. So cool that you’re learning to code! I tried to get into it a while back and learnt HTML and CSS, but eventually decided it wasn’t something I wanted to pursue further. I totally respect the ability to code though, that skill is so nitpicky over every small detail it’s crazy.

  4. I make table of contents manually using html anchors. Time consuming as hell.

    A block which automatically geverates them would be really cool!

      1. Oh yeah, same here. It’s so incredibly frustrating because the preview function can have problems too so I would keep having to switch to draft, publish the blog post, switch to draft etc etc, to check the anchors. There’s a “pending review” option, but I never tried it, so I don’t know if that’s better than publishing a bunch of times.

  5. I seriously thought you meant a mental health for children version of your blog every single time you’ve mentioned the child theme. Now it all makes sense, and I feel pretty dumb. Hehe. Although a place for mental health info for children would maybe also be a worthy niche…

    1. It would.

      I tend to forget that other bloggers have zero reason to have any idea what I’m talking about when I use obscure technical terms. I should really remember to explain myself more…

      1. This is the only time I’ve have ever been confused on your blog. You always take us by the hand, as you did in this one. I think you mentioned the child theme before in some of the weekly summaries. You can hardly expect a full explanation there!?

  6. Oh my gosh! You are such an achiever! I am inspired, but need to do everything in baby steps 🤦‍♀️ – Still working on that pinterest project LOL I am definitely bookmarking this for future reference.

  7. It’s nice to know how your child theme is coming along and to get a sneak peek when things well get messed up for no good reason 😅

    My site had a major breakdown this summer when I was trying to move off-site changes online and got disconnected from my web host sometime during the transfer 😅 Fun times 😂🙈

Leave a Reply