Customising the output of wp_list_categories
-
Hi all,
So I currently have a hard-coded list of links to categories & sub-categories on my site, each formatted like this.
<li><a href="/categories/interviews/" id="interviews">Interviews</a></li>
Each category link has been given an ID which matches its slug.
Subcategories are nested unordered lists, eg.
<li><a href="/categories/access/" id="access">Access</a> <ul class="subcategories"> <li><a href="/categories/access/open-access/" id="open-access">Open Access</a></li> <li><a href="/categories/access/closed-access/" id="open-access">Closed Access</a></li> </ul> </li>
I’d like to replicate this using
wp_list_categories
, but am unable to assign an ID to each<a>
element if I do this.I looked at doing this using
wp_get_categories
, but I need to keep the hierarchy of categories and subcategories intact, andwp_get_categories
only returns a flat list. And to further complicate things, I’m using the Category Order plugin to re-order my category order, which seems to only work withwp_list_categories
(correct me if I’m wrong).Thanks for reading –?any advice?
- The topic ‘Customising the output of wp_list_categories’ is closed to new replies.