I'm trying to include an image that will change depending on the page slug. I'd like this to populate across pages, categories, and posts. What I'm trying to say is this:
if page slug = main, use main.jpg
if page slug = contact, use contact.jpg
if category slug = media, use media.jpg
if category slug = news, use news.jpg
if none of these is true (i.e. is a post), use main.jpg
I sadly don't know the php well enough to improvise. The code I'm currently using works great for pages, but not posts or categories. It looks like this:
<img src="<?php bloginfo('template_url'); ?>/img/<?php echo $post->post_name; ?>.jpg" id="paper" alt="">
The page in question is annawaldron.com.
Please let me know if you have any thoughts. Thanks.