How to make category and subcategory cms links both active?

You can accomplish this with a small piece of jQuery.

On page load, you’d find your active subcategory link, and then identify its parent and apply the styling you want. If those category links already have an active styling, you can probably just trigger it by applying the class.

I can’t see your HTML structure but that would look something like this;

$(function() {
    
  $(".w--current") // find the selected item
    .closest(".cat") // find its category parent
    .children("span") // target the thing you need to style
    .addClass("w--current"); // apply the class you want
  
});

1 Like