WordPress.org

Ready to get started?Download WordPress

Forums

Already Got searchform.php file, how to add to top nav bar? (3 posts)

  1. emberjd123
    Member
    Posted 1 year ago #

    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

  2. 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.

  3. emberjd123
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic