foreach get category link
-
Dear WordPressers,
I have a pretty stupid question, that I do need to ask due to my inability to correctly write php.
I have this code that I use for an archive page.
<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>
I want to display the category for each post. The only problem now is that it just displays the category, but I want it to be a link to the category archive page. I tried many things, but I didn’t work. I know it is a probably a matter of brackets and spaces… but I did not manage to find out.
Thank you very much for your help.x Lauren
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘foreach get category link’ is closed to new replies.