I'm trying to figure out a way to include a div(which will contain a background image) for a specific tag. This block of code works but fails when a post has more than 1 tag. I'm using a page called tag.php which is the default template for all tags. I'll have quite a few tags so I don't want to create template files for them all, ie: tag-name.php
<?php if( has_tag('books') ) {
include 'tags/books.php';}
elseif ( has_tag('tables') ) {
include 'tags/tables.php';}
?>
It's always possible there is an easier way to do this. I essentially need a script that detects which tag is being viewed, as a page, then displays the correct image for it. So when the page for the tag "table" is loaded that tag will always use an image named "table.jpg"
Does anyone have any suggestions or know of a way I can modify the script above to do what I described?
tables.php
andbooks.php
like?