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:
What I want is:
I haven't been able to figure out what is wrong with my code. Can I get some help please? Thanks!