Getting number of menu item in wordpress

Is it possible to get only the 1st three items in wordpress menu?

for example I have these menus.

HOME ABOUT PROPERTY SEARCH CONCIERGE CONTACT

and I want to get ony the first 3 menus.

your help is much appreciated.

Answers


I dont think there is any argument for that but this can be done like this:

   $menu_name = 'custom_menu_slug'; // Get the nav menu based on $menu_name (same as     'theme_location' or 'menu' arg to wp_nav_menu)

    if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {
    $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );

    $menu_items = wp_get_nav_menu_items($menu->term_id);
    $count = 0;

    foreach ( (array) $menu_items as $key => $menu_item ) {
      $count++;
      if($count == 3 ) {
        break;
       }
      $title = $menu_item->title;
     }
    }

Need Your Help

How do I transfer the frame *and* transform from one UIView to another without distortion?

cocoa-touch uiview cgaffinetransform cgrect

I have a UIView that may have scale and/or rotation transforms applied to it. My controller creates a new controller and passes the view to it. The new controller creates a new view and tries to pl...