Archive for May, 2008

Adding a Wordpress options page and the first options

Friday, May 23rd, 2008

Although 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.

Sorting out the left sidebars

Wednesday, May 21st, 2008

As you may have noticed, the content of the left sidebar has been displayed above the header for the last few posts.

That’s basically down to an attempt at laziness which didn’t work. I thought that I’d get away with adding the styling for the left sidebars in header.php but that left me with a copy of the sidebar above the header so I ended up having to put the optional styling in sidebarLeft1.php, sidebarLeft2.php and sidebarLeft3.php. At the moment there’s no need to add similar coding into the right-hand sidebars as they don’t affect the layout of the screen whether or not they have content.

The code required is really simple and basically amounts to setting margin-left to either 2% or 0 and the width to either 10% or 0 depending on whether or not the relevant sidebar has any content.

That’s the sidebars pretty much fully sorted out now although I might return to them later and make that 10% width a calculated one so that the body of the text plus all enabled sidebars add up to 100% of the screen.

Copyright © 2008 by SevaTeem Ltd. All rights reserved.

Adding adsense to the theme

Sunday, May 18th, 2008

Adsense is eventually going to be an integral part of the SevaTeem theme and something that will be supported by the options page in due course (coming soon). However, since the number of hits on the site is rather higher than I was expecting I thought that I’d pop them in as a quick-fix for now which meant a small edit to the archives, index, page and single.php files along with the addition of google_horizontal.php.

All being well, the first version of the options screen will be making its appearance over the weekend and will initially support the selectable background image, the text colours and the first adsense options.

Copyright © 2008 by SevaTeem Ltd. All rights reserved.