[resolved] Adding subtitles to a custom menu in Twenty Ten child theme (7 posts)

  1. The_liz
    Posted 5 years ago #

    I'm trying to add sub-titles (based on a custom field set on each page) to my menu items using the method for wp_page_menu described here: http://themeshaper.com/wordpress-menu-tricks/
    BUT I'm trying to adapt it for a custom menu!

    Test site is here: http://leahbloom.dreamhosters.com/

    I've added the following code (appended at end of post) to a functions.php file in my child theme- the thing is, it adds subtitles when the last line of code is: "add_filter('wp_page_menu','childtheme_page_menu');"
    ... but that displays all pages, not my primary custom menu. If I change it to:
    ...then it displays the custom menu correctly but the subtitles go away. This must be because of the custom menu code in the Twenty Ten header:
    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

    Any way to combine these two?

    child theme functions.php is:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. Josh
    Posted 5 years ago #

    Another way to accomplish this is to use the menu description field. Here's a tutorial:

    I've actually done this in a twenty-ten child theme for a project and it worked out quite nicely. I can dig up the code if that helps. Let me know and I can post it.

    BTW, use the pastebin if you're posting more than a few lines of code (forum rules)

  3. The_liz
    Posted 5 years ago #

    @Josh: Yes, that's it! It works great, and I even added a few display tweaks. Thank you so much! :)

  4. Josh
    Posted 5 years ago #

    You're welcome.

  5. Paul van Zyl
    Posted 5 years ago #


    hey josh followed the tut, but not getting it right in a twenty ten child theme, would you mind posting a link to the code you used?

  6. Abhishek Jain
    Posted 5 years ago #

    can you re post your question?... i mean edit it properly and put the code in the < code > < / code >(without blanks) segment

  7. Paul van Zyl
    Posted 5 years ago #

    well, I followed the instructions from the linked tutorial above placing that code into my functions php, and managed to get a second menu displayed with poor styling, though with the subtitles,

    (do we really need to repost the code from the tut?)

    I would like to see what josh did specifically to have this working, though my ultimate goal here is not to create a second menu but to add the descriptions to the existing menu or alternatively replace the existing menu in a straight forward twenty ten child theme with a menu featuring the descriptions.

    any and all help would be greatly appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic