• Resolved The_liz

    (@the_liz)


    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: https://themeshaper.com/wordpress-menu-tricks/
    BUT I’m trying to adapt it for a custom menu!

    Test site is here: https://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:
    “add_filter(‘wp_nav_menu’,’childtheme_page_menu’);”
    …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]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Josh Feck

    (@builtbynorthby)

    Another way to accomplish this is to use the menu description field. Here’s a tutorial:
    https://www.kriesi.at/archives/improve-your-wordpress-navigation-menu-output

    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)

    Thread Starter The_liz

    (@the_liz)

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

    Josh Feck

    (@builtbynorthby)

    You’re welcome.

    @josh

    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?

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

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Adding subtitles to a custom menu in Twenty Ten child theme’ is closed to new replies.