Move Search Box to Secondary Nav

Community Forums Forums Design Tips and Tricks Move Search Box to Secondary Nav

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  genwrock 4 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #95007

    Hi,

    I’d like to move the search box to the secondary nav – the nav at the top of a page. I’m using the NewsPro theme, which is responsive. Ideally the solution will also be responsive.

    The site is cutroni.com/blog

    Thanks!

    http://cutroni.com/blog
    #95011

    genwrock
    Member
    Post count: 322

    You can use this code

    add_filter( 'wp_nav_menu_items', 'genesis_sub_nav_right', 10, 2 );
    
    function genesis_sub_nav_right( $menu, stdClass $args ){
       if ( 'secondary' !== $args->theme_location )
    		return $menu;
       // I hate output buffering, but I have no choice
      ob_start();
      get_search_form();
       $search = ob_get_clean();
       $menu  .= '<li class="right search">' . $search . '</li>';
       return $menu;
    }

    Working as a freelancer & helping the people on forum | Chinmoy @ PWD | Please Follow Me on Twitter If I’ve helped.

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

You must be logged in to reply to this topic.