template.php

I liked the idea of Sotak's calendar icons, but the colours didn't fit in with my theme, and I wanted the text to be a little easier to read, and to include the year.

So I made my own:

DEC 31 1999
JAN 22 2008
FEB 9 2025
MAR 22 2008
APR 22 2008
MAY 2 2025
JUN 31 2008
JUL 22 2008

Rather than an icon for each month, this technique uses just 1 background image (.png and psd attached) and a slightly modified template.php. Everything else can be styled with CSS.

With a bit of imagination, and a couple of tweaks to the function, and a few lines of CSS these icons can be very flexible. Different colour for articles over a year old? No problem. Colour coded by taxonomy? Sorted.

On my site, I use Lightbox 2 to display a high-res version of the original image when image thumbnails are clicked, rather than linking to the node.

However, I also wanted this behaviour for the images displayed in the Node body. You can see this in action here:

To do this, the image must be wrapped in an <a> tag - so you need to override the theme_image_body hook in your template.php file:

Syndicate content

Random Image:

Squirrel in Autumn Sunshine
Cattle
Charlie asleep in the conservatory
Brighton beach again

Pete's tweets (@prbass)

  • hmmmm, something has messed with my jquery slideshow. Wish there was a "drush undo" command #drupal 2 weeks 6 days ago
  • "drush" and "update" are my new favourite words #drupal 2 weeks 6 days ago
  • Geekiest way to read the news? New Guardian zeitgeist, complete with hex rgb codes on the key. Nice. http://www.guardian.co.uk/zeitgeist 4 weeks 6 days ago
  • We've run out of balsamic vinegar. What a middle class problem. 4 weeks 6 days ago