I have a custom list(ul) in wordpress sidebar. I want to add active class to list items.
<ul class="sidebar-list">
<li> <a href="index.php/owle/">OWLE</a></li>
<li><a href="index.php/sink-or-swim/">Sink or Swim</a></li>
<li><a href="index.php/swim-and-survive/">Swim and Survive</a></li>
<li><a href="index.php/vwsc/">VWSC</a></li>
<li><a href="index.php/water-smart/">Water Smart</a></li>
<li><a href="index.php/grey-medallion/">Grey Medallion</a></li>
<li><a href="index.php/aquatic-pd-workshops/">Aquatic PD Workshops</a></li>
<li><a href="index.php/edu-from-anywhere/">Edu From Anywhere</a></li>
<li><a href="index.php/bronze-e-lifesaving/">Bronze e-Lifesaving</a></li>
<li><a href="index.php/water-smart-award/">Water Smart Award</a></li>
<li><a href="index.php/victorian-water-safety-certificate/">Victorian Water Safety Certificate</a></li>
<li><a href="index.php/edu-from-anywhere-newsletter/">Edu From Anywhere Newsletter</a></li>
<li><a href="index.php/edu-casual-instructor/">Edu Casual Instructor</a></li>
<li><a href="index.php/grey-medallion/">Grey Medallion</a></li>
<li><a href="index.php/sink-or-swim/">Sink or Swim</a></li>
<li><a href="index.php/edu-instructor-of-year-profile/">Edu Instructor of year Profile</a></li>
<li><a href="index.php/swim-survive-licensee-of-year/">Swim & Survive Licensee of year</a></li>
</ul>
<li class="active"> <a href="index.php/owle/">OWLE</a></li>
should look like on ‘index.php/owle/’.
Add this to your wordpress them’s custom javascript. Lot of themes have that. Check theme customization.
if your theme don’t have this you have to hardcode this. I recommend you add this to your footer.php
}
you no need to do coding for it.
create sidebar with wordpress menu.
wordpress menu have default class for currunt item
and you can add css to it ..