Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is really bizarre - this has never happened before :/


I have a search.php template which consists of this...

    <?php
    /**
    * @package WordPress
    * @subpackage Example 2012
    * @since Example 1.0
    */

    get_header(); ?>


    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <?php the_title(); ?>

    <?php endwhile; ?>

    <?php endif; wp_reset_query(); ?>


    <?php get_footer(); ?>


this is what is in my functions.php

// SEARCH FORM HEADER
function search_form_header( $form ) {
    $form = '<form method="get" id="header-searchform" action="' . home_url( '/' ) . '" >
    <div>
        <div class="searchform-left"></div>
        <input class="searchform-mid clearit" type="text" name="search" id="search-header" value="Search" />
        <div class="searchform-right"></div>    
    </div>
    </form>';
    return $form;
}

add_filter( 'get_search_form', 'search_form_header' );


and this is how I'm calling my form...

<?php get_search_form('search_form_header'); ?>


And this is what my URL looks like when a search is performed (search query hello)...

http://www.example.co.uk/?search=hello


And all I get is the index.php?

And ideas would be truly amazing thanks. If you need more info please let me know thanks.

share|improve this question
    
Why the change from the core WordPress naming structure for the result in the URL string? As Chifliiiii suggested below, does your search result work if your change the input field to return "?s=hello" instead of "?search=hello" ? –  Brent Aug 13 '12 at 19:07
    
Don't know why I change this - but yep this is the problem. –  Joshc Aug 14 '12 at 8:31

1 Answer 1

up vote 3 down vote accepted

Change the form to:

<input class="searchform-mid clearit" type="text" name="s" id="search-header" value="Search" />
share|improve this answer
    
Thanks @chifliiiii –  Joshc Aug 14 '12 at 8:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.