Search Form not working on WordPress

I am having problems with the search form on wordpress. When i try and search any term at all it gives me the “Sorry, no posts match your query” response (I have “Search Everything” plugin installed too). I am using a child theme. so I tried to change the code in the child search.php (copied it to the child) and also created a searchform.php in the child. Here is the code from both of those that I am currently using:

SEARCH.PHP:

Read More
> <?php
/**
 * Search Template
 *
 * The search template is used to display search results from the native WordPress search.
 *
 * If no search results are found, the user is assisted in refining their search query in
 * an attempt to produce an appropriate search results set for the user's search query.
 *
 * @package WooFramework
 * @subpackage Template
 */

 get_header();
 global $woo_options;
?>      
    <!-- #content Starts -->
    <?php woo_content_before(); ?>
    <div id="content" class="col-full">

        <div id="main-sidebar-container">    

            <!-- #main Starts -->
            <?php woo_main_before(); ?>
            <section id="main" class="col-left">

                <header class="page-header">
                <h1 class="page-title"><?php printf( __( 'Search Results for: %s', '' ), get_search_query() ); ?></h1>
            </header><!-- .page-header -->
<?php
$query = new WP_Query( array( 's' => get_query_var('s')) );

// The Loop
if ( $query->have_posts() ) {
    echo '<ul>';
    while ( $query->have_posts() ) {
        $query->the_post();
        echo '<li>' . get_the_title() . '</li>';
    }
    echo '</ul>';
} 
?>
<?php var_dump($the_query) ?>
            </section><!-- /#main -->

            <?php get_sidebar(); ?>

        </div><!-- /#main-sidebar-container -->         

        <?php get_sidebar( 'alt' ); ?>       

    </div><!-- /#content -->
    <?php woo_content_after(); ?>
<?php get_footer(); ?>

SEARCHFORM.PHP (I got from the twenty twelve theme):

<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
        <label for="s" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
        <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
        <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
    </form>

I have tried different code for the searchform.php too such as:

  <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
        <label class="hidden" for="s"><?php _e('Search:'); ?></label>
        <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="GO" />
    </form>

and

<form role="search" method="get" id="searchform" class="searchform" action="<?php esc_url( home_url( '/' )); ?>">
    <div>
        <label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
        <input type="text" value="<?php get_search_query(); ?>" name="s" id="s" />
        <input type="submit" id="searchsubmit" value="<?php esc_attr_x( 'Search', 'submit button' ); ?>" />
    </div>
</form>

and

<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
    <label>
        <span class="screen-reader-text">Search for:</span>
        <input type="search" class="search-field" placeholder="Search …" value="" name="s" title="Search for:" />
    </label>
    <input type="submit" class="search-submit" value="Search" />
</form>

But still nothing. When it searches, this is what i get in the url:

http://www.energyhealing.directory/?s=energy&submit=Search

and on the page for that URL it displays:

Search Results for: energy << the title for it

Listed in
Continue Reading << thats a link to nowhere, just comes back to the same page

If someone could just explain to me where I have gone wrong and why, that would be amazing?

Thanks in advance for any help you can give. I look forward to hearing back from you!

Aww ok I see how to post in the question now:

Here is the code from the search.php which just returns the blank page:

  <?php
/**
 * Search Template
 *
 * The search template is used to display search results from the native WordPress search.
 *
 * If no search results are found, the user is assisted in refining their search query in
 * an attempt to produce an appropriate search results set for the user's search query.
 *
 * @package WooFramework
 * @subpackage Template
 */

 get_header();
 global $woo_options;
?>      
    <!-- #content Starts -->
    <?php woo_content_before(); ?>
    <div id="content" class="col-full">

        <div id="main-sidebar-container">    

            <!-- #main Starts -->
            <?php woo_main_before(); ?>
            <section id="main" class="col-left">

                <header class="page-header">
                <h1 class="page-title"><?php printf( __( 'Search Results for: %s', '' ), get_search_query() ); ?></h1>
            </header><!-- .page-header -->
<?php
$query = new WP_Query( array( 's' => get_query_var('s')) );

// The Loop
if ( $query->have_posts() ) {
    echo '<ul>';
    while ( $query->have_posts() ) {
        $query->the_post();
        echo '<li>' . get_the_title() . '</li>';
    }
    echo '</ul>';
} 
?>
            </section><!-- /#main -->

            <?php get_sidebar(); ?>

        </div><!-- /#main-sidebar-container -->         

        <?php get_sidebar( 'alt' ); ?>       

    </div><!-- /#content -->
    <?php woo_content_after(); ?>
<?php get_footer(); ?>

Related posts

Leave a Reply

1 comment

  1. EDITED (for search.php):

    <?php if ( have_posts() ):?> 
            <ul>
            <?php while ( have_posts() ) : the_post();?>
    
                <li><?php the_title();?></li>
            <?php endwhile;?>
            </ul>
     <?php endif;?>
    

    I think the searchform.php is ok, but I don’t see a loop anywhere in your search.php

    $query = new WP_Query( array( 's' => get_query_var('s')) );
    
    
    // The Loop
    if ( $query->have_posts() ) {
        echo '<ul>';
        while ( $query->have_posts() ) {
            $query->the_post();
            echo '<li>' . get_the_title() . '</li>';
        }
        echo '</ul>';
    } 
    

    You need this query to create a loop based on the search.