• I’m trying to resolve a problem with anchor (or jump) links in the main wordpress menu.

    If I place a number of jump links to the same page within the menu, it highlights all of the jump links to that page, instead of the one clicked. This is an issue when I navigate to the page with a number of jump links via the menu from another page Is there a workaround to this issue?

    I know this has something to do with the php inserting the current-menu-item class to highlight a link in the menu based on the URL of one’s page, but is there a way to filter out current-menu-item class based on the # for the anchor links?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the slow response, I’ve been away.

    Yes, you should be able to filter the classes assigned with the ‘wp_nav_menu_objects’ filter. Examine the passed menu items array structure to determine how to access the assigned classes.

    If you’re willing to create or alter a child theme (and not simply do this via plugin), a better approach is to locate the theme’s call to wp_nav_menu() and add or overwrite a walker argument. Your walker will have complete control over the HTML created for all menu items, with the ability to apply quite complex logic to how it is created.

    How do I get my anchor links to highlight when they are jumped to? Please help!

    http://wordpress.org/support/topic/highlighting-anchor-page-jumps?replies=1

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Anchor links, menu, and highlight current’ is closed to new replies.