I was hoping tonight I’d have a Flex version of the rated new fiction project that provided rated lists for each of the different new materials RSS feeds for King Library. I started working on it yesterday and it’s almost done, but I haven’t quite finished it up yet.
Instead, I thought I’d talk a little about something I recently learned about in WordPress: theme options. In creating my blog, I had some fun tinkering with the Magazeen theme to make it more to my liking. Here are some of the changes I made:
- removed the pink and replaced it with purple (my favorite color)
- shortened the header and got rid of the “latest post” dock – these might be good for other sites, but for me it felt like there was too much empty space before you were able to read any real content
- adjusted the sidebar some – mostly reducing the level of empty space at the top and bottom of each pod
- adjusted the footer – added the “meta” section to it between the categories and author information
I notice when I added the theme that there was an options section:

This is something that I wasn’t familiar with before. The one option for the Magazeen theme is the “about the blog” blurb that it shows in the footer. I wanted to change that section to be “about the author” and to also display a picture, so I adjusted the existing option and added a second one.
Where to find the options
For this theme, the options can be found in the file
wp-content/themes/themedir/inc/functions/options/base.php.
What I found there was an array with one item for the “about the blog”. I adjusted it to be an “about the author” option and added an “author picture” option as well, so that this is what my code looks like (note that the ‘$pre’ variable is defined elsewhere as ‘mag_’, for magazeen)
<?php
// Create an array of options.
$options = array(
array(
"name" => "General Settings",
"type" => "section"
),
array(
"name" => "About the Author",
"description" => "Author information.",
"id" => $pre."_about_author",
"std" => "",
"type" => "textarea",
),
array(
"name" => "Author Picture",
"description" => "Author picture URL.",
"id" => $pre."_about_img",
"std" => "",
"type" => "text",
)
);
?>
Now the options page, accessible from my dashboard, looks like this (after I’ve added my information):

How to use the options
To use the information, access it using the ‘get_option’ function using the “id” that we had in our options. For example:
<?php $authorImg = get_option('mag_about_img'); if ($authorImg != "") echo "<img src=\"$authorImg\" alt=\"Author Picture\"/>" ?>
<?php $authorInfo = get_option( 'mag_about_author' ); if ($authorInfo != "") echo $authorInfo ?>
Once the option has been set, it can used anywhere in the blog. This is a nice way to add some customizations if you’re making a theme, or a nice place to store some information if you’re going to use it in multiple places throughout the blog. Theme options could be used to let a user decide where to place the sidebar, what colors to use in a layout, or to store information about the blog such as a description of it. Adding this information to the options means that you can change it and access it through the dashboard, without having to touch any code, and makes it easy to update the information.
My name is Heather and I ♥ monkeys. I am a computer scientist in San Jose and my background is in cognitive science, computer science, usability, and library and information science. My interests include preservation, oral history, indigenous knowledge and technology. 
It‘s quiet in here! Why not leave a response?