WordPress change sub-category class

I’m having trouble with my WordPress site.

I have a page displaying my categories and sub-categories.
They are displayed in a <ul>.

Read More

Now I want to give the sub-categories a class to style them differently.

Is this possible with a walker maybe?

I can’t change the template because it’s is loaded in via a plugin (Events manager)

EDIT:
the HTML that is generated:

<ul>
<li>Category</li>
<li>sub-Category</li>
<li>sub-Category</li>
<li>Category</li>
<li>sub-Category</li>
<li>sub-Category</li>
</ul>

Related posts

Leave a Reply

1 comment

  1. I can’t change the template because it’s is loaded in via a plugin (Events manager)

    It depends on the plugin. You should look at the documentation for your plugin. Some plugins will load a default template but allow you to override it with one of your own in your theme. The plugin may provide a filter that allows you to customize the output, but this seems like a very specific customization you’re not likely to find.

    Did you know you can target child <ul> elements in CSS without a class? For instance, the following would target only <ul> elements that are nested under a <ul> element:

    ul ul {
        background-color: red;
    }