Skip to content

Instantly share code, notes, and snippets.

@Spellhammer
Created April 23, 2020 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Spellhammer/6f819b3bc86691b1513afc0bc1e7ed55 to your computer and use it in GitHub Desktop.
Save Spellhammer/6f819b3bc86691b1513afc0bc1e7ed55 to your computer and use it in GitHub Desktop.
Manually set active menu styles using JS.
jQuery(document).ready( function() {
var path = window.location;
jQuery(".menu-item a").each(function () {
var href = jQuery(this).attr('href');
if(path == href) {
jQuery(this).closest('li').addClass('current-menu-item');
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment