Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
Question
I’m using the wp_list_categories()
function which generates an unordered list with list items and anchor tags for the categories. Is there any way to add HTML attributes to the <a>
tags which hold the category links?
I’d like to add a title
attribute which is the same as the category, and a class
attribute, but looking at the docs, in the list of associative array properties I can’t see how to do this?
The code I’m using is:
<?php
echo '<ul class="cat-sidebar-list">';
$args_list = array(
'taxonomy' => 'news_categories',
'show_count' => false,
'hierarchical' => true,
'hide_empty' => false,
'title_li' => '',
);
echo wp_list_categories($args_list);
echo '</ul>';
?>
Thanks in advance for any help.
0
accessibility, categories, html, php
5 months
0 Answers
88 views
0
Leave an answer
You must login or register to add a new answer .