WordPress.org

Ready to get started?Download WordPress

Forums

Adding a class to parent links in default, non-custom menus (1 post)

  1. mbi_marc
    Member
    Posted 2 years ago #

    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:
    http://codex.wordpress.org/Function_Reference/wp_nav_menu#How_to_add_a_parent_class_for_menu_item

    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.]

Topic Closed

This topic has been closed to new replies.

About this Topic