“Upgrade to the latest version of PHP [the language that runs WordPress, the software that runs this site]”, the email from my hosting provider said. “Better performance” it said. “The version of PHP your site is running on is no longer supported, and won’t be getting security patches” it said. So, I figured, “Why not?” This site runs on WordPress, and I figured WordPress would be well tested on the latest PHP. So I clicked the button to upgrade the site… and the site died.
I followed the instructions for troubleshooting WordPress. I renamed the plugins folder, and the site came back partially– the page shell was visible, but not the content. Clearly, there was at least one plug-in that was incompatible. When I switched the site back to one of the stock themes, the text became visible again, and I knew there was a problem with the child theme.
A little trial and error located the errant plugins — there were two of them. One was the plug in that allowed me to reverse the normal order of posts within the Bonaire categories — I want the posts in those categories to be in chronological order. Fortunately, I found a different plugin to handle that.
The second one was the plugin that I used to display my tweets on the page. I’m less concerned about that now since Twitter has become such a shit-show. I removed that plug in entirely, and enabled the rest. The site continued to run.
Now it was time to find the problem with the child theme. I knew there was a file called “functions.php” that contained overrides to the stock theme. Looking at it, the most likely culprit was the “posted_on” function, that displays the date of the post. I’d customized it to show the date using a “calendar-like” appearance. So I commented it out, and the the site content came back. I knew I had the right culprit. At that point, the site was functional, though lacking the custom post dates. I needed to get supper and take care of some errands, so I left it in that state temporarily.
When I came back, I took a closer look at the problem. Unfortunately, I don’t know PHP, and don’t really know the WordPress internals, so I started by comparing the default version of the function with my customized function. Eventually, I realized I was calling esc_html( get_the_date(M) ), The esc_html function returns escaped HTML, while get_the_date() returns the post date. What I was trying to do was get the month part of the post date. Both of these functions are WordPress functions. The docs said that get_the_date() takes any PHP date formatting string. And then the word “string” jumped out at me. The M was unquoted. I quoted the parameter in each of the calls, and my content (and custom post date) came back. Huzzah!
Now it was time to clean up a few loose ends. I noticed the category display was gone, but in its place were two copies of the “tag cloud”. It turns out one was from a newer version of the theme, and one was from a legacy widget I’d added. I removed the legacy widget, and added a widget to display the post categories.
Then I took a second look — the categories were actually still present in the footer area. So I pulled it out of the side bar, and put the random post plugin back in its place. In the footer, I put a top posts plugin which would show my top posts if I get some traffic, but for now, is showing my most recent posts.
So there you have it. The site is back up and running. At the moment, it’s running in Christmas mode. I’ve made some tweaks to my plugins and sidebar widgets that most people probably won’t even notice.
The bigger question, of course, is whether it’s time for a redesign. This theme is long in the truth, but to be honest, I still like the way it looks. So, we’ll see.