I am trying to echo the category nicename to reference a category image stored in my images folder in another folder called categories.
I am using this code:
$category = get_the_category();
echo '<img src="'.get_bloginfo('template_directory').'/images/categories/'.$category->category_nicename.'.png">';
But all it returns is this:
<img src="http://www.fightfansradio.com/wp-content/themes/FFR2/images/categories/.png">
What I want is:
<img src="http://www.fightfansradio.com/wp-content/themes/FFR2/images/categories/categorynicename.png">
I haven't been able to figure out what is wrong with my code. Can I get some help please? Thanks!