Finally I have started the daunting process of moving all my blogs - this one, the Minim-Media news feed, One Creative Thing and the 16-week blog I sort-of kept in the last semester of my Grad. Dip. - over to WordPress. Blogger's been annoying me for quite a while now because it's got so incredibly slow and every post, no matter how short, takes 5 or more clicks of "This is taking longer than expected - do you want to wait?" just to get the wretched thing online. With the result that I haven't really been posting anywhere other than Vox for the last six months, and now that we've sorted out a UK host who has given us unlimited space, it's time.
And so the past two days I've been sorting out a template for One Creative Thing, because for the past year since it was created, it's been languishing in a prefab (but nice and clean) Blogger template and that, of course, is a case of "You can't take it with you when you go", so I got out my pen and watercolour pencils, and then Photoshop, and then Dreamweaver and made up a new design and coded it, and today I've been tweaking that code to turn it into a proper WordPress template. I'm rather pleased with the results, but I have to say, it's been very frustrating trying to add in widgets - everything seems to assume that you already know exactly how to get your widget into your page, and when I discovered that I needed my template to be "widget-aware", I was sent to this article on automattic.com as what seems to be the standard reference for "widgetising" a WordPress theme, but could I make head or tail of it? No. Part of the problem was that it sounds like they're widget developers themselves and I couldn't tell when they referenced a chunk of code whether that was for general widgets or their own widget (Answer: mostly it seems to be general), so, having figured it out, I thought I'd write my own description of how I did it, which hopefully might help others who are similarly bewildered.
OK. So now that you know these two vital pieces of information, how do you go about it? Firstly, I am indebted to How to widget-enable WordPress Themes in 3 Easy Steps for actually making sense of everything.
This is the file that contains functions specific to your site. What you need to do is to invoke the register_sidebar function to warn WordPress that you have a sidebar you want to add widget(s) to. You do this with:
'', 'after_widget' => '', 'before_title' => '<h4>', 'after_title' => '</h4>', )); ?>(Note that this assumes you are not using WordPress's default markup which uses H2 for all sidebar headings and an unordered list for the sidebar content - if you have this sort of setup, have a look at the "3 Easy Steps" link above for the right code.
This seems fairly self-explanatory, and maybe it is for you, but alas, my brain did not work that way and it took some time to work out the following:
'' in 'after_title'If you plan on having more than one widget in your sidebar, you need to call register_sidebar as many times as you plan to have widgets on the page, each with its own name, so adjust as follows:
register_sidebar(array( 'name' => 'sidebarname', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h4>', 'after_title' => '</h4>', ));
Note the addition of the 'name' attribute at the top of the array? That's the only difference. Just drop these one after the other, each with its own name (it may be best to make these a bit meaningful so you and anyone else who may use your theme can see what you intend to go in there. For maximum flexibility, the automattic.com article describes a good failsafe method that will show a static sidebar, should something go wrong with adding in your widgets).
Once you've registered however many sidebar areas you need to cover the widgets you want (and more than one widget may go in a sidebar area, but you might want to specify different areas for specific purposes), you're going to have to specify those areas in the sidebar.php file itself.
In each place you want the widget to appear, you need to put in a call to the 'dynamic_sidebar' function, each one customised to the name of one of the widget areas you specified in your functions.php file, like so:
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('sidebarname') ) : ?>
<?php endif; ?>
Note that if you put any code in between the first php tag and the second, it will be overwritten. Change the name of 'sidebarname' to be that of whichever widget you want in that space, the same as you did when registering that sidebar area in the functions.php file (that is, if you called it 'calendar_widget' in the functions.php file, you'll need to use ... !dynamic_sidebar('calendar_widget') in the sidebar.php file too.
Then in WordPress all you have to do (probably) is install your widget(s), activate them and set them for the spaces where you want them to appear. The names you gave each sidebar space in functions.php will appear on the widgets page, so you can easily determine which one you want where. Some widgets may require further tweaking of the PHP, but that is a topic for someone else to cover as I haven't yet played with any of those.
Labels: code, tools of the trade, website
I am currently looking forward to an improvement in my quality of life. Next week I take delivery of a brand new computer. And not only a brand-new computer, but two brand-new operating systems. For I am shortly to be the owner of an Intel-based MacBook Pro, which will be running both Mac OS (Tiger) and Windows XP. I'll also be getting ProTools, which I'm sure will provide me with hours and hours of amusement... erm... solid work being done. Sorry. Slight slip there :-)
It's been amazingly stressful, working out the upgrade. ProTools is notoriously fussy and there are a bunch of sites listing all the tweaks you need to make to Windows in order just to get it to run. It's fussy about chipsets. It's fussy about the operating system. It's fussy about everything with the result that the makers' website lists only 6 Windows laptops that they recommend to run it (3 from Dell and 3 from HP if you're curious). They do test out specific chipsets and whatnot, so in theory you can find your own system that should work, but in practice, the Windows forum on their site is full of people saying "Why won't this work?" whereas the Mac forum is full of people saying "How do I get this cool effect?"
So I started off looking at the recommended machines, quickly ruled out HP as ludicrously expensive, then discovered that Carillon (who make their living producing systems for musicians and custom-tweak the OS before you even take delivery of it) produce a laptop which was about the same price as the Dell. So then it was Dell vs Carillon - which boiled down to "off-the-shelf generic machine possibly leading to problems setting up" vs "more expensive system but they'll ensure it works". Just as the Carillon was inching ahead (that "more expensive" bit was hard to overcome!), a friend emailed me saying he had just bought an Intel Mac and Windows XP ran lightning fast on it and why didn't I come on in, the water was fine. So I went and had a look at the Macs and... it all went from there. It was a bitter struggle, but in the end the MacBook Pro won, and it should be arriving early next week. I'll be running ProTools under the Mac OS, and pretty much everything else (to start with, anyway) under Windows XP - going to be quite the experiment!
Needless to say, my old laptop has been driving me nuts the past week - with the prospect of a new speedy machine on the way, the slowness has been unbearable, not to mention the crashing-five-times-a-day routine. I am looking forward to retiring it to the position of MP3-minder, beside the stereo.
But nevertheless, I have managed to get work done. The Satie arrangement is proceeding quite well, but a little bit stalled as I need ProTools to work on a tape part for it. I have also nearly finished a new song, to words by Walt Whitman, for tenor and piano, which I think will be part of a set of either four or six similar songs. It's been marvellous to be writing vocal music again. I really enjoy it. I think I might mostly work on songs for the next little bit.
Labels: arrangement, composition, computers, laptop, mac, macbook pro, song, tools of the trade, vocal music