Wednesday, December 4, 2024
Web   

Hacking at PHP and WordPress

At the end of last year, I updated my blog to a new theme, and I’ve largely been happy with it! Two things I’ve noticed since then is that tags missing (from posts, from list.. pretty much they never get diplayed with this theme) and the search function is hidden unless you’re logged in. One of my favorite features of WordPress is the number of parts that will auto update… including themes! Of course, if you make a change to an existing theme, there are some approaches to keep in mind:

  1. Make the change directly to the Theme – of course that means any changes will get wiped out by the next update! Bummer
  2. Another option would be to make a complete copy of the Theme, and then make your changes there. Of course, now those changes won’t get wiped out by updates … but you also won’t benefit from updates either. Double bummer!

3. The third option (and best) is to make a Child Theme. There are already sources and tutorials on-line for doing that, this was my first time.

So far, I’ve been happy with the results!

I don’t often hack on PHP; (it’s been about 12 years!) a few things that have really helped my workflow:

  • VS Code with PHP support
  • VS Code FTP Sync plugin
  • I’ve created git repo with just my themes. It’s been really nice to be able to make changes, back those out, add “logging” code to parts of a theme, see where that shows up – and then know that I’ve backed all of those out before I move on.
  • I’m considering a GitHub Action to FTP just my child themes when I make changes. I’m resisting automating deploying main themes – since they auto-update and I wouldn’t want to accidently overwrite those.

My next challenge will be to tackle will be returning the search button to the main navigation when you’re not logged in.

Similar Posts