Adding a Wordpress options page and the first options
Friday, May 23rd, 2008Although Kubrick comes with an options page, it’s a really complicated looking affair and doesn’t address the type of options that SevaTeem will be offering.
Fortunately, a couple of people have done sterling work on easing the creation of options pages. The Undersigned blazed the trail in 2006 with a great tutorial as to how to go about creating options pages and Literal Barrage added more sophistication to the original design. I’ve taken aspect of both from them in creating the initial options page for SevaTeem.
As with Kubrick, the Literal Barrage version has more complexity than I need right now. Having said that, some of the bits which I deleted from it include support for version checking of the theme which I may end up adding back in later.
One thing that can cause confusing errors being reported is that the functions.php file can’t finish with a blank line. Since that file is used both for displaying the blog and in the admin you can get peculiar errors all over the place.
So, what about those options?
First up was the font colours: you can now choose the colour of the main text and that used in the sidebars from the options page. Implementing that requires moving all but the identifying information from the style.css file, putting it in style.php and then using the variables provided through the option page at the appropriate points ie replacing “color:black” by “color:<? echo SevaTeem_font_colour ?>”.
Next was the first of the adsense options. The horizontal block in the posts is controlled by the options page where you can also add your adsense publisher id.
I’ll be looking at making the width of the main page and sidebars an option next. That’s going to mean that I need to revisit the right sidebars to incorporate the code from the left ones.
It’s easy to get carried away with an options page so once I’ve the sidebars sorted out, I’m going to sit back and have a think about what really needs to go in there. While I’m doing that, I think a good run through style.php is in order as I’ve been chopping and changing it all over the place throughout the development of this theme and it’s in need of a tidy-up.
Copyright © 2008 by SevaTeem Ltd. All rights reserved.