I began work on the Body Connection Spa website in December 2010. Just a few months earlier WordPress added support for ‘Custom Post Types‘. I used the custom post types feature for the ‘Special Offers’ on the Body Connection Spa site.

I decided to use ‘bc-special-offers‘ as the internal name for my CPT. This was great and everything worked as expected. Except one area – the admin area that listed the special offers.

As CPTs were relatively new, there weren’t many blog posts about them. I chose to use dashes instead of underscores as that is what most filenames used during my time working with GNOME when I worked at Sun Microsystems. The reasoning is that dashes are quicker to type, while underscores need the Shift key. It turned out that the dashes were the problem – none of the blog posts mentioned this!!

In my code I simply changed ‘bc-special-offers‘ to ‘bc_special_offers‘ and it all worked. I did have to make the same change in the database (post_type column in the wp_posts table) so that the existing Special Offer posts were still accessible but I was relieved to finally be able to display custom columns. I added ‘Expiry Date & Time’ and ‘Price’ columns.

Body Connection Spa Special Offers page with custom columns

I got a lot of help from these two articles: