CSS – speeding things up

A bit of house-keeping (for wont of a better word) first, I’ll be moving this blog in the next couple of weeks to integrate with my website www.bigthingsandlittlethings.co.uk. When I first set this blog up I wasn’t entirely sure what form it was going to take but I’ve managed to keep it quite web-relevant (thus far) so it seems silly to keep two separate identities running when really they are parts of the same thing….

Now, boring stuff over, on with the blog.

This isn’t a hugely technical blog this time but covers a few CSS-related things that I have found make a big difference to workflow and just generally making things a bit easier to organise and manage.

I came across the notion of CSS ‘global resets’ a few years ago, to me they make a great deal of sense, especially with regards to white space (http://leftjustified.net/journal/2004/10/19/global-ws-reset/) – I find it far easier to start from nothing and completely build up my styling in the knowledge that I’ve specified every element rather than let some odd default browser setting trip things up. The notion here is that all browsers have default margin/padding/font-face/etc settings for elements that will be applied if you don’t specify an alternative, the annoying thing being that all of these browser defaults are slightly different. With a global reset you, as the name suggests, reset all instances of the specified attribute (whether its padding, margin, font-face, whatever) to zero, or Arial, or black depending on the attribute in question. This then gives you a specific base point to work from – which I find very useful.

Some good examples of CSS resets can be found here http://perishablepress.com/press/2007/10/23/a-killer-collection-of-global-css-reset-styles/ and a good one here http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/ http://www.christianmontoya.com/2007/02/01/css-techniques-i-use-all-the-time/ http://warpspire.com/features/css-frameworks/

A further use of resets is detailed here, http://www.smashingmagazine.com/2007/09/21/css-frameworks-css-reset-design-from-scratch/ Smashing Magazine takes CSS resets as an element of their suite of recommendations for developing a CSS framework – on reading this article I realised that I already used my own framework to some extent (I just didn’t refer to it as such) as there were certain stylesheet practices and scripts that I use as a matter of course – the acknowledged disadvantages of frameworks – such as the time taken to familiarise yourself with them and the possibility of inheriting bad code if you use someone else’s – didn’t really come into play as all the code I use is hand-written by me, I’m not saying I’m perfect though!

I’d be interested to hear about people’s experiences using some of the external CSS frameworks out there – there is a handy list of some of them here http://www.webdesignbooth.com/10-promising-css-framework-that-worth-a-look/ – have they streamlined your workflow or do they cause more problems than they solve?

There are also a couple of great articles at Smashing Magazine (who I rate highly – as you can probably tell) regarding good CSS practice and tips for better coding here http://www.smashingmagazine.com/2009/07/20/50-new-css-techniques-for-your-next-web-design/ and here http://www.smashingmagazine.com/2007/05/10/70-expert-ideas-for-better-css-coding/

Istanbul to Leeds – 30 days to go (i think)

If my slightly bad maths is anything to go by (i didn’t have enough fingers and toes to count accurately), then it is just over 4 weeks until I leave as part of the convoy of support vehicles to drive out to Istanbul ready for the start of the Jane Tomlinson Appeal’s latest madcap challenge, the Istanbul to Leeds bike ride (www.istanbultoleeds.co.uk).

I’m having my final innoculation this evening (this one for tick-born encephilitis – which sounds pretty horrible) and then I’m pretty much good to go. My job will start on the evening of 21st July when I’ll meet up with the other drivers (there are 6 of us driving the vehicles out there) and the vehicles – an RV, a car and a transit van – to drive down to Folkestone and then across the whole of mainland Europe to Istanbul. It’s just shy of 2,500 miles and we hope to make it in about 3 days. Each vehicle will have 2 drivers and we’ll take turns driving, then sleeping. I think we’re hoping to be in Istanbul on Saturday 24th with the ride starting on Monday 26th July – the riders will have flown out on the Friday evening.

I’m not sure how prepared the riders are, I know the Miller family (Mike Tomlinson’s sister’s family) have been training pretty well since early this year and I have, on more than one occasion seen John (Mike’s brother-in-law) riding a tandem on his own – which must take a certain level of dedication! Mike has been cycling to work and back (a journey of about 10 miles each way) so will probably be in much better shape than he was on the last challenge (2008’s end-to-end ride), the Hinde family all seem to be fairly fit and I’m sure Stuart has been getting them out and about and Becca Tomlinson is mega fit anyways and has been subjecting herself to spinning classes at the gym. So I’m sure everyone will be more-or-less ready…a bit.

4 weeks to go…it’s going to be an adventure.

I’ll be blogging about it all quite regularly here and also on the ride’s site. You can sponsor the riders here http://www.justgiving.com/Istanbul-to-Leeds-2010. It’s an incredible challenge they’re all taking on and your support would be hugely appreciated. If you can’t afford to donate then the riders will be (hopefully!) arriving back in Leeds on Bank Holiday Monday 30th of August – it’d be great if there were some people out to welcome them home!

WordPress – styling by category

I’ve spent the best part of this morning working out how to add a post’s category to its h2 tag’s class – which then allows me to do category-specific styling. Essentially I wanted each headline to be a different colour based on its category – simple result, slightly convoluted solution.

Anyways, it took a while so I thought I’d share it here to save others the hassle!

You first need to add the following to your functions.php file

<?php
function the_category_unlinked($separator = ‘ ‘) {
$categories = (array) get_the_category();

$thelist = ”;
foreach($categories as $category) {    // concate
$thelist .= $separator . $category->category_nicename;
}

echo $thelist;
}
?>

Basically this takes the results of the usual the_category() query – i.e. an unordered list – and strips out all the list formatting and presents the results as a nice list of the categories, with each category separated by a space.

You can then add this to your h2 (or whatever tag you want to style) class=”ADD HERE” in your index.php file (or wherever you need)

<?php the_category_unlinked(‘ ‘); ?>

This pulls the category info as formatted by the function you just wrote in the functions.php file – i.e. without any list formatting.

You then just need to add the relevant class styling info (e.g. .categoryname{some styling}) to your styles.css file and you’re good to go.

Hopefully this was useful.

So, you think you want a website?

A while ago, on my personal blog, I mused about things you should consider when you have that epiphany…”we need a website”, worth a read I’d say (but then I wrote it, so I would say that wouldn’t I…) http://ashmannblogs.wordpress.com/2010/04/19/so-you-think-you-want-a-website-4-things-to-consider/

Rock ness

So last weekend Becca and I toddled off to Rockness, a festival held, perhaps unsurprisingly given the name, on the banks of Loch Ness.

First things first, we were driving, or ,more accurately, I was driving as Becca is still learning. Now I realise how far Inverness is from Leeds having driven up and around there when I was driving support on the End-to-End bike ride in 2008 (http://ashmannblogs.wordpress.com/2009/01/19/bike-rides-and-vans/) but still I think my brain had blanked just how far it really is – 366 miles, 7 hours driving, mega. Although the saving grace is that it is a bloody lovely journey scenery-wise going through the Yorkshire Dales, the top of the Lake District and the Caingorms – ace! Anyways, we got there and set up the tent and drank some wine from our elegant and sophisticated boxes of wine and then wandered off to see pendulum – who were brilliant.
Saturday saw us mainly trying to recover from the Friday night and then on Sunday (in the rain) we saw the Macabees, Blondie, an amazing DJ called Benji Boko, a standup called Kevin Bridges and The Strokes – who were all very, very good.
The festival was in by far and away the most stunning location I imagine any festival could be in, surrounded by beautiful countryside, hills and of course a bloody massive loch. Add to that the fact that everyone there was incredibly friendly (apart from about 2 hours when the England match was on and everyone turned very pro-USA for a bit) and we had an excellent weekend. Rockness, recommended!

Istanbul to Leeds

On Friday I was at the launch of the Jane Tomlinson Appeal’s latest challenge, the Istanbul to Leeds bike ride. Mike, Steven and Becca Tomlinson along with several other family members and friends will be riding the 2,500 miles from Istanbul, Turkey to Leeds, England over the course of 5 weeks. They’ll average about 80 miles a day and travel through 12 countries.

I will be reprising the role I played on the last ride (John O’Groats to Lands End) in 2008, which mainly consists of driving a van filled with bikes and gatorade and taking lots of photos and video footage.
As well as driving support I also put together the ride’s website www.istanbultoleeds.co.uk which I’ll be updating throughout the build up to the ride and then (hopefully) every day of the ride.

The ride is taking place to raise money for the Jane Tomlinson Appeal (full info here www.janetomlinsonappeal.com) and you can sponsor the riders here, www.justgiving.com/Istanbul-to-Leeds-2010.

It really is a pretty mega undertaking and any support you can offer would be greatly appreciated.

Launches and lunches

Righty, so tomorrow sees the launch of the reason why I will be out of the country for 5 weeks this summer. If you live in Yorkshire then I think it will be covered on Look North and Calendar tomorrow evening, if you don’t live in Yorkshire then there should still be a veritable explosion of web-based excitement for you to gorge on (or not, whatever).
More (actual) news to follow tomorrow.

WordPress theme development and the white screen of death

I’m currently working on a new site for a client who requires a CMS. After a fair amount of research and based on my own experiences they decided that WordPress fitted the bill. So I needed to develop a bespoke theme for them.

Now I’ve messed around with tweaking wordpress themes before and it is pretty intuative. Unfortunately last night the whole thing came crashing down and I had to battle with the (apparently infamous) ‘white screen of death’ – which usually seems to be caused by a php bug. These bugs can be as simple and innocuous as an additional line break in your code (WordPress doesn’t like space it would seem). I’ve not yet tracked down the source of my ‘white screen’ issues (EDIT – I have since found the source of my bugs, it was caused by such an innocuous thing i still can’t quite get my head around it! basically i needed to remove and all space between each function in my functions.php file – i.e. so there was no space between each closing ?> tag and the following opening <?php for the next function. it’s ridiculous that such a small thing brought everything crashing down, but there you have it…) but if you’re suffering from something similar then there are numerous lists that should help troubleshoot the problem. Here are just a few that I’ve found helpful:

http://wordpress.org/support/topic/405711

http://wordpress.org/support/topic/363816

http://www.amandavandervort.com/blog/2009/12/how-i-solved-my-wordpress-white-screen-of-death/

I’d also add that if you’re considering WordPress theme development then it’s a good idea to have a good read of the documentation first (there are lots of dependancies that it’s useful to be aware of so the whole thing doesn’t come crashing down) http://codex.wordpress.org/

And there are also a number of very good tutorials around WordPress theme development. Again, here are a few I’ve found helpful:

http://www.wpdesigner.com/2007/02/19/so-you-want-to-create-wordpress-themes-huh/

http://themeshaper.com/wordpress-themes-templates-tutorial/

http://jonathanwold.com/tutorials/wordpress_theme/

http://codex.wordpress.org/Theme_Development

http://codex.wordpress.org/Blog_Design_and_Layout

http://net.tutsplus.com/articles/web-roundups/top-50-wordpress-tutorials/

http://net.tutsplus.com/site-builds/how-to-create-a-wordpress-theme-from-scratch/

Hope that helps!