1. Welcome to the Upload WP Community Forums!  This is the best place to get premium WordPress and WooCommerce support.  Please take a look around and join the Upload WP Community for FREE today!

Virtue Theme Search Box in Navigation Box

Discussion in 'WordPress Questions' started by Savidge4, Jun 9, 2014.

  1. Savidge4

    Savidge4 Upload WP Superstar

    Virtue Theme Search Box in Navigation Bar

    I will tell you that I have played with this for a day or 2 and decided that my method to getting this done was going to be your basic hack job. I reached out to the folks at Kadence Themes, the makers of the Virtue Theme for some assistance.

    As you may have read in many of my other review type articles, I am big on support, and the designers ability to offer solutions. With a couple of back and forth e-mails, this was resolved within an hour give or take. Responsive, happy to help, and on point. That is exactly the words I would use to describe my experience.

    So back to the topic of the Post. How to insert a search box into the Primary Navigation area. The Navigation area located in the upper right corner of the header, right below the top bar.


    The code to get this done is PHP code. You will want to insert this code in your child themes functions.php. If you do not have a child theme setup, you then will want to place this in the functions.php file. You will find this in 'Dashboard' 'Appearances' 'Editor' and then to the far right column you are looking for "Theme functions (functions.php)" It is pretty close to the top.

    To insert the code, they have not left a spot like some themes do, to do so. you simply want to ENSURE you create a line or 2 below what is existing.

    add_search_form_to_menu($items$args) {

    // If this isn't the main navbar menu, do nothing
    if( !($args->theme_location == 'primary_navigation') )

    // On main menu: put styling around search and append it to the menu items
    return $items '<li class="my-nav-menu-search">' get_search_form(false) . '</li>';

    Again a special thanks to the guys over at Kadence Themes with the assistance on this!

    Last edited: Jun 12, 2014
    TeddyTriton likes this.