Add class to links generated by wp_list_categories

I am using the wp_list_categories() function and it is outputting a list with each
<li> containing an <a>
The <li> tags are being given a cat-item class but no classes are being given to the <a> tags.
How do I add a class to the <a> tags?

<li class="cat-item cat-item-207"><a href="http://www.olliepress.dev/category/css/">some text</a>
</li>

Why do you want to add a class name to the <a> tags? If you want to style them, just style .cat-item a .

Or did you have another reason for wanting the extra class names?

2 Likes

I am trying to adopt a css architecture of having flat specificity - aiming for one class only selectors .
Check out the writing/speaking of Harry Roberts and others to see the benefits of this approach.
Not sure how easy it is to tie in with a CMS like WordPress.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.