Title: Function for Main nav menu
Last modified: August 22, 2016

---

# Function for Main nav menu

 *  [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/)
 * Hello again, sorry for all these questions, but I like sooo much your theme and
   I’d like to enrich it with little details to make it perfect for my company 🙂
   🙂
 * I copied a function in the Functionality plugin editor, as hannah suggested, 
   but it’s not working. I used it with the theme Graphene, here it is:
 *     ```
       function my_custom_menu_item( $items, $args ) {
           if ( function_exists ( 'the_msls' ) && 'Header Menu' == $args->theme_location ) {
               $obj = new MslsOutput;
               $arr = $obj->get( 2 );
               if ( !empty( $arr ) ) {
                   $items .= '<li>' . implode( '</li><li>', $arr ) . '</li>';
               }
           }
   
           return $items;
       }
       add_filter( 'wp_nav_menu_items', 'my_custom_menu_item', 10, 2 );
       ```
   
 * A flag should display on the right of my Main nav menu ( [http://www.spinips.com](http://www.spinips.com))
   and allows to skip to the translation of the visited page ( [http://www.spinips.com/en](http://www.spinips.com/en)–
   I still need to change theme there, but you can see a widget with languages at
   the bottom of the home page)
 * May you help me someway? Thank you!!

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260390)
 * Or maybe I can add something in the topbar by changing the function above or 
   by setting the icons menu, I don’t know…
 * Something instead of “Chi Siamo” would be great!
 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260460)
 * Sorry, not the topbar, it’s too small up there, and not even the primary menu(
   where is “Chi siamo”) because it’s not displayed in mobiles…. 🙁
 *  [Ben Ritner – Kadence WP](https://wordpress.org/support/users/britner/)
 * (@britner)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260499)
 * You can make it display in mobile with this css:
 *     ```
       #nav-main {
       display:block;
       }
       ```
   
 * Try this for your function:
 *     ```
       function my_custom_menu_item( $items, $args ) {
           if ( function_exists ( 'the_msls' ) && 'Primary Navigation' == $args->theme_location ) {
               $obj = new MslsOutput;
               $arr = $obj->get( 2 );
               if ( !empty( $arr ) ) {
                   $items .= '<li>' . implode( '</li><li>', $arr ) . '</li>';
               }
           }
   
           return $items;
       }
       add_filter( 'wp_nav_menu_items', 'my_custom_menu_item', 10, 2 );
       ```
   
 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260580)
 * Both are not working…. 🙁
 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260585)
 * I found that Functionality plugin is not working in multisite
    [http://wordpress.org/support/topic/multisite-solution?replies=3](http://wordpress.org/support/topic/multisite-solution?replies=3)
   and as suggested installed Code snippets but WordPress collapsed after entering
   a snippet with my function…
 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260597)
 * I fixed the crashing down but the function is still not working…

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Function for Main nav menu’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/virtue/3.4.15/screenshot.png)
 * Virtue
 * [Support Threads](https://wordpress.org/support/theme/virtue/)
 * [Active Topics](https://wordpress.org/support/theme/virtue/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/virtue/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/virtue/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [spinips](https://wordpress.org/support/users/spinips/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/function-for-main-nav-menu/#post-5260597)
 * Status: not resolved