Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter deanWP

    (@deanwp)

    Hello Paul

    I like to thank you with your very nice and useful theme.

    I wish to put a search box and a menu on the right, like in the foundation image here.

    So I insert the code below into the function.php.

    add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);
    function add_search_box_to_menu( $items, $args ) {
        if($args->theme_location == 'contact') {
            ob_start();
            get_search_form();
            $searchform = ob_get_contents();
            ob_end_clean();
    
            return $items . "<li class='menu-header-search'><form action='' id='searchform' method='get'><input type='text' name='s' id='s' placeholder='Search'></form>";
        }
        return $items;
    }
    
    And copy and rename my menu-primary.php
    <?php
    include_once 'inc/topbar-walker.php';
    if ( has_nav_menu( 'search-menu' ) ) :
    
     wp_nav_menu( array(
    	'container' => 'nav',
    	'theme_location' => 'search-menu',
    	'container_class' => 'top-bar right',
    	'menu_class' => '',
    
    	'items_wrap' => '<section class="top-bar-section"><ul class="right"><li class="divider">%3$s</section>',
    	'walker' => new Foundation_Walker(),
    	'fallback_cb' => 'false' ) );
     endif;
    ?>

    And I got this image.

    How I wish to have this image.

    I wanted to implement the foundation nav bar with the search bar on it, like this.

    I appreciate any help and thank you.

Viewing 1 replies (of 1 total)