Add a class “active” on Category Posts Menu

I would like to add an active class on Category Post Menu. I’ve used it as a widget.

This is my code:

<ul class=”category-posts-menu”>
<li class=”cat-posts-item”><a href=”#”>Link</a></li>
<li class=”cat-posts-item”><a href=”#”>Link</a></li>
</ul>

What I would like to achieve is:

<ul class=”category-posts-menu”>
<li class=”cat-posts-item **active**”><a href=”#”>Link</a></li>
<li class=”cat-posts-item”><a href=”#”>Link</a></li>
</ul>

How can I add a custom class to highlight the current post?
Can you help me, please?

Read more here:: Add a class “active” on Category Posts Menu

Leave a Reply

Your email address will not be published. Required fields are marked *