Skip to content

Instantly share code, notes, and snippets.

@iagdotme
Created September 4, 2013 07:47
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 iagdotme/6433904 to your computer and use it in GitHub Desktop.
Save iagdotme/6433904 to your computer and use it in GitHub Desktop.
When you use a custom post type in WordPress the menu incorrectly chooses the "posts" menu as being active. This little jQuery script fixes that. The example below works for the Events custom post type for the Event Organiser plugin, but you can change it two whatever you like...
if ($("body").hasClass("single-event") || $("body").hasClass("tax-event-venue") || $("body").hasClass("tax-event-venue") || $("body").hasClass("tax-event-category"))
{
$("li.menu-news").removeClass("active");
$("li.menu-whats-on").addClass("active");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment