Support » Themes and Templates » Adding a class to parent links in default, non-custom menus

  • Hey there. I’m trying to add a custom class to top-level navigation links if they have child pages. I know this is a topic that’s been covered before, but please bear with me.

    The code found here:

    comes to incredibly close to answering my question, but only appears to work for menus that are defined using Appearance->Menus in the admin, and I need it to function for the menu that is automatically generated by wp_nav_menu when it is given absolutely nothing to work with.

    The idea being that my client can’t be trusted to manage the menu, so it needs to be generated automatically when a page is added/removed.

    I’m using WordPress 3.4.1, a custom theme loosely based on TwentyTen. I cannot provide a link as my development server is not accessible beyond my own network.

    I’m a moderately savvy beginner at this, and I’m completely new to WP filters, so not sure where to go from here.

    Any help is greatly appreciated!

    [No bumping, thank you.]

  • The topic ‘Adding a class to parent links in default, non-custom menus’ is closed to new replies.