Theme Support Forum

Support Forum for Free and Premium Themes. Premium Theme Forums are Private! Please log in first to see the Premium forums

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

Search in my main menu

Home Forums Misc. General Forums Search in my main menu

  • #12452

    roman

    subscriber

    Hi,

    i am using Cylla Pro and i would like to put my search box into my main menu.

    Did anybody has an idea how this works?

    Regards

    Roman

    #17394

    Towfiq I.

    administrator

    Go to Appearance> Editor and select “functions.php” and add these lines:

    function add_search_to_wp_menu ( $items, $args ) {
    if( 'primary' === $args -> theme_location ) {
    $items .= '<li class="menu-item menu-item-search">';
    $items .= '<form method="get" class="menu-search-form" action="' . get_bloginfo('home') . '/"><p><input class="text_input" type="text" value="Enter Text & Click to Search" name="s" id="s" onfocus="if (this.value == 'Enter Text & Click to Search') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter Text & Click to Search';}" /><input type="submit" class="my-wp-search" id="searchsubmit" value="search" /></p></form>';
    $items .= '</li>';
    }
    return $items;
    }
    add_filter('wp_nav_menu_items','add_search_to_wp_menu',10,2);

    before this line:

    //Post Thumbnail

    #17395

    roman

    subscriber

    I added this lines (at the end of the list), but i did`nt worked 🙁