Writing a WordPress theme from scratch
About the sidebars
Although the new theme appears to contain two sidebars, it actually features seven: the wide one at the top of the right-hand column; two below; and four footer areas, into which I can insert widgets.
The advantage of having so many widget areas is that I can move items around, test what works well, all within the WP interface. To do this I had to do two things: firstly, the functions.php file contains the code:
if ( function_exists('register_sidebar') )
register_sidebars(7);
?>
This gives me seven widget-ready fields. I could have more, of course, simply by changing that number.
To insert these areas into the page, I used this code:
That inserts the content of sidebar 4 into whichever part of the page I wish to have it. Enclose the code in div tags and it's simple to position them.
Other matters
To disable curly quotes, as detailed in a previous post, I added this code to functions.php:
This was then added to header.php:
remove_filter ('the_content', 'wptexturize');
remove_filter ('comment_text', 'wptexturize');
remove_filter ('single_post_title', 'wptexturize');
remove_filter ('the_title', 'wptexturize');
remove_filter ('the_excerpt', 'wptexturize'); ?>
When I relaunched the site, I discovered also that my rss feed was broken. I eventually isolated this to space in the header - a result of adding line breaks to the code. I also found that having the Google search box before the rss/Feedburner links caused a problem; swapping the code around fixed it, but I'm still none the wiser as to why it happened.
Stats
One of the key requirements of the new theme was to have the main body of code before any sidebars, to allow search engine spiders to index it more successfully. It was a shame, then, that I suffered a drop in page impressions of roughly 10% (I think it was roughly the same for unique users). Although the page urls were all the same as previously, I suspect it was user confusion that caused people to leave.
Thankfully, after a few weeks the stats went up even higher, and the site is doing better than ever. It's not a hugely-successful site, currently getting around 3,000 page impressions a day, but if it continues to grow as it has been then I'll be happy. And the earnings from Google AdSense have gone up accordingly - again, not by a huge amount, but this was always about the long term rather than a quick and easy way to make money.