Support » Fixing WordPress » Already Got searchform.php file, how to add to top nav bar?

  • Already have searchform.php file as detailed below. How can I now add search box to top nav bar, on right hand side?

    <form method=”get” id=”searchform” action=”<?php bloginfo(‘home’); ?>/”>
    <div>
    <input onblur=”if(this.value==”) this.value=’type and hit enter to search'” onfocus=”if(this.value==’type and hit enter to search’) this.value=”” type=”text” value=”type and hit enter to search” name=”s” id=”s” />
    </div>
    </form>

    Thanks my website

Viewing 2 replies - 1 through 2 (of 2 total)
  • Add <?php get_search_form(); ?> to whatever location you want it to appear in — presumably the <nav> or <div> element that holds your navigation. You’ll also want to add #searchform {float: right;} to your CSS if it isn’t there already.

    Thread Starter emberjd123

    (@emberjd123)

    Thanks v much for your reply.

    New to this, so hoping you can point me in the right direction. Under css stylesheet I got:
    .searchbar{float:right;width:290px;height:31px;margin:0;z-index:100;}
    .searchform{width:290px;height:20px;text-align:left;}

    My last bit of coding under the header is:
    <div id=”header”>
    <img src=”<?php bloginfo(‘template_url’); ?>/images/header.gif” alt=”insurance”/>
    <?php wp_nav_menu(‘menu=topnav’); ?>
    </div>

    Would I put your coding above the </div> under the header?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Already Got searchform.php file, how to add to top nav bar?’ is closed to new replies.