In this post, I am going to cover the Admin UI elements of the Quote of the Day code. You can read the previous post to see how I created the custom QOTD post and the tag taxonomy. In that article, I also created the form to enter quotes using the new custom fields of Quote, Person and Source.
If you were following along, you may notice a few gaps in the functionality. The big one is when you select “All Quotes” in the admin panel, which results in the default display of Title, Author, Date, etc. This is not very useful when trying to maintain the list of quotes – so next we are going to customize the display to include our new columns.
You may have noticed from the last couple of articles that I have an interest in both role-playing games and programming. I am taking a quick break from writing code for the Connexions RPG, which is primarily intended to played around a table or in your living room, to mention why the two things (designing Connexions and writing code) go very well together.
One obvious reason is the goal to allow you to play the game how you want to play it. Writing code that implements the Connexions base rules and models elements means that it can be reused to create either an online table for the game, or possibly a full CRPG down the road.
But that is not why I am doing it at the moment…
You may be asking what the purpose of this blog is. In the header, it says “The blog for the Connexions RPG” and I thought I would add a little context to what that means.
Like many longtime gamers, I have enjoyed a lot of different role-playing games. While many of those games were computer games, the ones that stuck with me were the more traditional table-top variety. The energy of being surrounded by friends, having fun, is what really makes the experience.
Also like many longtime gamers, I have my own opinions about what an RPG should be. Those opinions are the basis of the Connexions RPG.
When starting with a new technology (in this case WordPress) I like to give myself a simple little project to get to know the platform, the APIs and the supporting languages. Back when I was teaching, one of the exercises was to create a simple “Quote of the Day”.
The original code was a Perl CGI application that parsed a simple text file, seperated it into the sections to display, and formatted it so it would display inline on the home page. The only additional function was to randomly select one quote to display each time the page was refreshed.
After reviewing the basic docs, I decided to do the following:
- Create a custom post type for the quotes
- Update the header section to place it over the image
- Give the user the option to turn it off (and as a phase 2) the choice of types to display
Just a quick warning about the code that follows, I am known to continuously tinker, so what you see below is very unlikely to actually be the code on the site unless you are reading this the moment I post!