Wp_nav_menu page-item-ID and page_item classes (3 posts)

  1. finestimaginary
    Posted 1 year ago #

    I've relied on the page-item-ID class to add specific styling to nav items based on custom fields, but it seems that it's only working once you're actually on that page in current WP releases.

    Seems a bit strange, but I couldn't find any bug issues around it...

  2. Michael
    Part-Time Forum Moderator
    Posted 1 year ago #

  3. finestimaginary
    Posted 1 year ago #

    There's no code as such, it's whenever I use the wp_nav_menu function to call a menu.
    So the menu was set-up in functions using register_nav_menus, then set-up in the admin and attributed to that menu, then called in the front-end.

    The "Backward Compatibility with wp_page_menu()" classes are ONLY added to the nav item when you're on the actual page of that particular nav item.

Topic Closed

This topic has been closed to new replies.

About this Topic