Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1364098
    ATCompressors
    Participant

    Morning X-Team. 🙂

    I found the following thread in the forums about activating the descriptions for mega menus.
    mega-menu-description-field-cornerstone-update

    The following jQuery was provided by one of you wonderful X-Men but it doesn’t seem to work on the Integrity stack.

    add_filter( 'walker_nav_menu_start_el', 'gt_add_menu_item_description', 10, 4); 
    function gt_add_menu_item_description( $item_output, $item, $depth, $args ) {
        $desc = __( $item->post_content ); 
        if($desc){
           return preg_replace('/(<a.*?><span>[^<]*?<\/span>)</', '$1'."<small class='nav-desc'>{$desc}</small><" , $item_output); 
        }
        return $item_output;    
    }

    I’m not the best with JS or jQuery, so I would be super grateful if you could advise how I could alter the code to work on my website.
    I’ll leave my login credentials separately. 🙂

    #1364112
    ATCompressors
    Participant
    This reply has been marked as private.
    #1364850
    Rad
    Moderator

    Hi there,

    Thanks for posting in.

    Would you mind providing your FTP login credentials as well? I just like to test it. It’s not a javascript, but PHP 🙂

    Thanks!

    #1365967
    ATCompressors
    Participant
    This reply has been marked as private.
    #1366491
    Rad
    Moderator

    Hi there,

    Ah your descriptions are from custom link, the above code is only applicable for menu item as post type.

    I went ahead and implemented the correct one, and please add this CSS to Admin > Appearance > Customizer > Custom > CSS for format the description.

    .sub-menu .nav-desc {
    display: block;
    width: 100%;
    }

    Hope this helps.

    #1371966
    ATCompressors
    Participant

    Rad! You’re the absolute best!
    Thank you so very much for your help. 😀

    #1372115
    Joao
    Moderator

    Glad to hear it

    Joao

  • <script> jQuery(function($){ $("#no-reply-1364098 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>