Navigation / Menu Descriptions

Community Forums Forums General Discussion Navigation / Menu Descriptions

This topic is: resolved

This topic contains 3 replies, has 3 voices, and was last updated by  philweb 1 year, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #50914

    philweb
    Participant
    Post count: 3

    I want to do a Menu WITH description using Generate Theme. I saw a theme related to what i wanted: http://demo.studiopress.com/backcountry/

    This time, i want it on the primary navigation.

    Something like this: http://screencast.com/t/WHL9e2c5

    I already activated the description in the “Screen Options” on Appearance>Menus .

    I tried to ‘google it’ but can’t find something that work

    • This topic was modified 1 year, 3 months ago by  philweb.
    • This topic was modified 1 year, 3 months ago by  philweb.
    http://www.3rhomeschool.com
    #50936

    Susan
    Moderator
    Post count: 9254

    You need to add the code to call it in the functions.php file. In the case of the Backcountry theme, the function is in the secondary menu, and the functions.php includes this code:

    [php]
    /** Add description to secondary navigation */
    add_filter( ‘walker_nav_menu_start_el’, ‘add_description’, 10, 4 );
    function add_description( $item_output, $item, $depth, $args ) {

    $args = (array) $args;

    if ( $args['theme_location'] != ‘primary’ ) {
    return preg_replace( ‘/(<a.*?>[^<]*?)</’, ‘$1′ . "<span class=\"menu-description\">{$item->post_content}</span><", $item_output );
    }
    else {
    return $item_output;
    }

    }
    [/php]

    You can adjust the code accordingly to reference the primary menu.


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #50945

    braddalton
    Participant
    Post count: 10217
    #51097

    philweb
    Participant
    Post count: 3

    done. Thanks

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Navigation / Menu Descriptions’ is closed to new replies.