• Resolved fibroidcincinnati

    (@fibroidcincinnati)


    Hi. I am modifying the header to add a search field. I have been able to add it and move it around to different positions. But none of them are quite right.

    I would really like to have it at the end of the front page navigation menu. Floating inline with it immediately after as if it were the last menu item. I found this code in another forum to add search to the Nav menu. But when I add it to functions.php WordPress goes crazy and even the wp-admin site displays incorrectly.

    Any idea how to make this code work with Sela in the current WordPress version?

    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 == 'primary' )
            return $items.get_search_form();
    
        return $items;
    }
Viewing 1 replies (of 1 total)
  • Thread Starter fibroidcincinnati

    (@fibroidcincinnati)

    I couldn’t get that code to work. I abandoned that plan and instead got this to work using a plugin…. It’s called “bop” search plugin and adds the search box to the menu bar. I then used some CSS to modify the style.css and the plugin.php files to style it the way I needed to.

Viewing 1 replies (of 1 total)
  • The topic ‘Add search to front page menu in Sela’ is closed to new replies.