WordPress.org

Ready to get started?Download WordPress

Forums

search form on page itself, not the template (3 posts)

  1. Max Sewell
    Member
    Posted 1 year ago #

    I've created a custom template and can get a search form working if it's in the custom template. I need a search field on the page itself, i.e., where an end-user would edit the page content (above and below the field). Is this possible?

    See:

    http://newsite.discovereuropeltd.com/newsite/our-tours/

    The top search field ("Search Upcoming Tours") below the first paragraph doesn't work. It's on the page, not the template. The bottom search field ("Search Previous Tours") which is actually in the custom template does work.

    Thanks for any help you can provide.

  2. Max Sewell
    Member
    Posted 1 year ago #

    This is the code I used (on the page) --A variant of it is in the template for the second field:

    <div style="width:440px;height:30px;">
    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <label class="hidden" for="s"><?php _e('Search for:'); ?></label>
    <div>
    <table><tr><td>Search Upcoming Tours: </td><td><input style="width:150px;" type="text" value="Type in a country name" name="s" id="s" onfocus="if (this.value == 'Type in a country name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Type in a country name';}" /></td><td><input type="submit" id="searchsubmit" value="Search" /></td></tr></table>
    </div>
    <input type="hidden" name="taxonomy" value="tours">
    <input type="hidden" name="term" value="2013">
    <input type="hidden" name="orderby" value="date">
    <input type="hidden" name="order" value="asc">
    </form>
    </div>

  3. Max Sewell
    Member
    Posted 1 year ago #

    My son figured this out for me. We replaced the php code in the form action with the domain: and everything works.

    <form method="get" id="searchform" action="http://newsite.discovereuropeltd.com/newsite/">

    Sorry for the bother.

Topic Closed

This topic has been closed to new replies.

About this Topic