1

I'm using wp_list_categories to output my categories in Wordpress. The results are:

<ul>
  <li class="cat-item cat-item-1"><a href=".." >..</a></li>
  <li class="cat-item cat-item-8"><a href=".." >..</a></li>
  <li class="cat-item cat-item-10"><a href=".." >..</a></li>
</ul>

Is there a way to remove these default classes on the list items? So to remove cat-item and cat-item-#? Thanks!

WIWIWWIISpitFire
  • 1,539
  • 1
  • 12
  • 20
  • The default class you mean the `cat-item cat-item-1` ? – Nicolas Feb 13 '17 at 14:08
  • yes that's what i mean :) – WIWIWWIISpitFire Feb 13 '17 at 14:10
  • jquery for doing it afterwards: http://stackoverflow.com/questions/2644299/jquery-removeclass-wildcard – Johan Feb 13 '17 at 14:15
  • Well using JQuery you could iterate through the `ul` children and remove their classes using `$(element).removeClass()` – Nicolas Feb 13 '17 at 14:18
  • Using jQuery feels a bit backwards as the output of the php is stil the same. That way i will be adding it and then remove it immediately. I don't want to add it in the first place. Is there a way to hook into Wordpress like one would do when removing body classes? – WIWIWWIISpitFire Feb 13 '17 at 14:20

0 Answers0