Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1377566

    Hello,
    How can I assign Main Menu #1 to Pages/Articles and Main Menu #2 to Portfolio items?

    Best regards
    Oriano

    #1377595

    Hey Oriano,

    Thanks for contacting us!

    Please refer to this post – https://kriesi.at/documentation/enfold/menu/#different-menu-for-different-pages

    You can use the code as following and change menu names :)

    
    function my_custom_wp_nav_menu_args( $args = '' ) {
    
    if($args['theme_location'] === 'avia') 
         if( is_singular( 'portfolio' ) ) { 
              $args['menu'] = 'Anchor Menu'; 
              } else { 
              $args['menu'] = 'Full Menu';
              } 
    return $args;
    }
    add_filter( 'wp_nav_menu_args', 'my_custom_wp_nav_menu_args' );
    

    Best regards,
    Yigit

    • This reply was modified 1 year, 10 months ago by Yigit.
    #1377653

    yes – but do not forget to add the filter:

    function my_custom_wp_nav_menu_args( $args = '' ) {
    if($args['theme_location'] === 'avia') 
         if( is_singular( 'portfolio' ) ) { 
              $args['menu'] = 'Anchor Menu'; 
              } else { 
              $args['menu'] = 'Full Menu';
              } 
    return $args;
    }
    add_filter( 'wp_nav_menu_args', 'my_custom_wp_nav_menu_args' );
    
    #1377658

    Hi,

    Exactly! Thanks a lot @guenni007! I tested it on my local installation before posting and apparently forgot to copy a very important line :) I edited my post as well

    Best regards,
    Yigit

    #1377682

    Thanks Yigit, thanks Guenni007, for your help.
    I am testing in the MAMP local version of the site.

    Best regards
    Oriano

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.