I completed the changes to this site that I started yesterday but didn’t finish because of some last-minute bugs (glad to have found them before uploading). The main issue keeping me from updating the site was that the featured posts functionality of Cornerstone was not working properly. Featured posts in Cornerstone are similar to WordPress’ own sticky posts functionality in that it lets you place specific posts in front of the normal chronologically-sorted posts, which is useful when you want to highlight certain content. Featured posts in Cornerstone differs from WordPress’ sticky posts in that it offers somewhat more customizability and control over how/when featured posts are displayed.
However, due to some changes last night, the featured posts weren’t being retrieved for output on the site. To be quite honest, I wasn’t sure what I could have changed yesterday that could have broken the featured posts functionality, so I had no idea what to expect when I started investigating it this morning. Thankfully the issue was relatively minor and was causing the wrong section ID to be used when attempting to retrieve featured posts for a specific section of the site. I tightened up a couple conditional statements to make sure the section ID is properly retrieved and featured posts were once again working!
With that out of the way, I proceeded to prepare for deploying all updates to the production server. Since everything had been updated to work with WordPress 3.0+, the first order of business was upgrading the production server to WordPress 3.0.1. After that, I updated Cornerstone and the site’s theme files. I cleared my cache, hit refresh, and held my breath. The site loaded up fine and everything is working great on the production server! The final step was changing the Dump section to Know, which basically entailed adjusting the section’s title, slug, and icon.
It took longer than expected for such a small change (all I originally intended to do was change the name of a section), but in the end the site is much better and more stable for the work that went into it.
As with any situations that require troubleshooting, there are always lessons to be learned. Here are some I lessons learned or reaffirmed today:
- Test, Test, Test – before any update big or small, I always follow the same workflow:
- Develop and test the code on my computer
- Upload updates to the offsite staging server (basically a private mirror of the public production server) to test for issues not found while testing locally
- Upload updates to the production server (the public site) and run through tests to confirm no issues exist
The goal is of course to avoid any downtime on the public site and this basic workflow has saved me many headaches on all of my projects. I should note that prior to each step I also backup all relevant files and databases so that I can revert to a working version very quickly and start fresh if things get too messy while I troubleshoot an issue.
- Exercise caution when manipulating WordPress’ post queries – Cornerstone hooks into the post query process in several modules (permalink rewriting, content types, featured posts, etc.) and I feel rather comfortable manipulating the query variables to retrieve the posts that I want, but it is also very easy to invalidate the query with just a small change. Vigilance is key when manipulating post query objects.
I enjoy troubleshooting because I like the challenge of finding elegant solutions to problems. Nonetheless, I am glad that I was able to work out the issues rather quickly today because it feels good to have my production site running the latest version of WordPress.
I’m about to start working on 2 small WordPress plugins that I have been thinking about recently (one of them since this morning). One is intended to improve privacy and the other will make it easier to customize a site’s favicon from within WordPress. I’m looking forward to it.