Add categories listing footer to every entry on an archive view
-
Hi,
I’d like to add a listing of all the categories a post is in, after the post when it’s viewed as an archive – category, home page feed etc. I’m sure I’ve done this before, but I can’t remember how.
I’d like to style it to match the .entry-meta style.
As far as I can see, every entry in an archive view, consists of an article tag, inside which is a header class entry-header, and a div class entry-content. I assume what would be best would be to have a footer class entry-footer added to that.
I assume that needs to be changed in the content.php file? I copy that file from the twenty seventeen theme, to my child theme – do I need to match the directory structure and have it in a /template-parts/post directory?
In content.php, I see after the entry-content div, there’s this part:
<?php if ( is_single() ) { twentyseventeen_entry_footer(); } ?>
My guess is that is what causes the footer to appear on a post but only when it’s viewed on its own.
Can I add some sort of else statement to that, which would put in a plain listing of categories, separated by commas, but without an Edit button or anything. So it would read along the lines of:
Posted In: Category 1, Category 2, category 3.
Any guidance would be appreciated.
- The topic ‘Add categories listing footer to every entry on an archive view’ is closed to new replies.