how can i adding a css class to my get_category_link href ?
-
so i found this code to get me through my problems here are the support section to display the category of an ancestor category to which the post belongs to… here fore example the ancestor is cat-id 4868:
<div> <?php foreach((get_the_category()) as $childcat) { if (cat_is_ancestor_of(4868, $childcat)) { echo '<a>cat_ID).'">'; echo $childcat->cat_name . '</a>'; echo ' '; }} ?> </div>
so im able to display the category of the ancestor category that my post belongs to… and it’s linked to its’ category page!
but i’m trying to add a css class to that individual link and i want it to be the slug of that specific categoy link that is being displayed…i tried insterting every posible php code in place of the “???????” in that code above but nothing works… any help?
i had the css class in the div i wrapped around the code but sometimes i get displayed 2 categories and i can’t style them individually when that happens, that’s why i want each link to have it’s specific class… that’s why i also added another echo with a blank space to spereate the categories displayed when more than one is displayed…
- The topic ‘how can i adding a css class to my get_category_link href ?’ is closed to new replies.