Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.