Custom Category Image – Got that to work, but can't get it to link to it's URL
-
I was able to create a custom image for each category on my site here: http://www.pinkfloydonline.com – (Notice the purple arrows that say “Pink Floyd News” and “Pink Floyd Video of the Week”.
Now I am trying to get it to link to it’s category, but can’t seem to get it to work.
Here is the code I used for the custom image:
<?php foreach((get_the_category()) as $category) { echo '<img src="http://pinkfloydonline.com/images/' . $category->cat_ID . '.png" alt="' . $category->cat_name . '" title="' . $category->cat_name . '" />'; } ?>
I looked at the codex and tried adding
<?php get_category_link( $category_id ); ?>
like this:<?php foreach((get_the_category()) as $category) { echo '<a href="<?php get_category_link( $category_id ); ?>"><img src="http://pinkfloydonline.com/images/' . $category->cat_ID . '.png" alt="' . $category->cat_name . '" title="' . $category->cat_name . '" /></a>'; } ?>
But it didn’t work.
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Category Image – Got that to work, but can't get it to link to it's URL’ is closed to new replies.