WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


Im using a basis of the Twenty Twelve theme and im using the below script (yes i know that the wrappers are not correct as yet)

However its defaulting back to the main page... any ideas?

* The template for displaying Search Results pages.

get_header(); ?>

<section id="primary" class="site-content">
    <div id="content" role="main">

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

        <header class="page-header">
            <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'Clearwatch' ), '<span>' . get_search_query() . '</span>' ); ?></h1>

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>

    <?php else : ?>

        <article id="post-0" class="post no-results not-found">
            <header class="entry-header">
                <h1 class="entry-title"><?php _e( 'Nothing Found', 'Clearwatch' ); ?></h1>

            <div class="entry-content">
                <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'Clearwatch' ); ?></p>
                <?php get_search_form(); ?>
            </div><!-- .entry-content -->
        </article><!-- #post-0 -->

    <?php endif; ?>

    </div><!-- #content -->
</section><!-- #primary -->

Well guys i double checked my search form and it had index.php in below:

so i changed it to my search.php path and it appears to be searching but defaulting back to my own website theme? Any ideas

  <form id="searchform" method="get" action="<?php bloginfo('template_url'); ?>/Clearwatch/search.php">
share|improve this question
Is the file called "search.php"? – Jake Apr 2 '13 at 12:31
hi Jake, yes it is – Kirsty Marks Apr 2 '13 at 12:33

Ive actually solved this. It appears that there were some errors in the search.php file which resulted in lots of issues.

Thanks for your comments.

share|improve this answer

Your Answer


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.