WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working an a Thematic child theme wherein I need to have a unique image decorating each of the site's main pages, from a pre-defined set of permanent images. It would also be ideal to have one of these same images randomly selected to appear on all other pages.

Using a sidebar widget to load the images seems like a good option, but I don't know how to create my own widgets yet, and haven't had any luck finding a plugin which provides the simple functionality I'm looking for. I also don't want to clutter up the admin panel with plugins and options that the client shouldn't be fiddling with.

I think it will probably be most ideal to put something into my functions.php which adds some generated markup to a Thematic hook based on the page ID, but I'm not quite sure what I'm doing, so I thought I should ask to see if someone already has a great solution.

share|improve this question
up vote 4 down vote accepted

Looking at their demo source, the easiest way to do this is by styling page classes like pageid-69 or slug-example-page:

  background: url(...);

If it has to be random image, add your styles in the header template so you can use PHP to generate dynamic css.

share|improve this answer
Thanks, that should get it done. – Dees Jan 3 '11 at 21:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.