What I want to do is, within single.php
, pull different properties of the Category separately, like this:
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<a class="CATEGORYSLUG" href="CATEGORYLINK">
<i class="fas CATEGORYDESCRIPTION"></i>
<span>CATEGORYNAME</span>
</a>
<?php endwhile; ?>
<?php endif; ?>
To produce an end product like this:
So that I can use:
- the category slug as a CSS class, to style each category a unique color
- the category description as a Font Awesome class (in this case, "fa-wrench"), to assign each category a unique icon
(For this project, each post will only be assigned a single category, but I suppose a future-proof solution would need to output ALL categories assigned to the post in this format.)
So I really just need to know how to individually pull:
- Category slug
- Category link
- Category description
- Category name