I've looked around and can't figure out what happened to my search page. It used to work but then I guess why I added my archives.php and a bunch of other things it stopped working, but I can't tell at what point in the last week it stopped working.I usually test almost everything on the site when I make changes but for some reason I didn't check the search function until near the end and then it was too late. This is the site.

        <div id="main">
        <?php if ( have_posts() ) : ?>

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

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php get_template_part( 'loop', 'search' ); ?>

            <?php endwhile; ?>

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

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

        <?php endif; ?>

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

And of course I have my php opening and closing tags, header & footer. I just didn't want to add everything.

Currently, if you search for a word that you know is somewhere in the site it returns a NOTHING FOUND. I believe it's to do with my get_template_part as I don't quite understand the wordpress codex for it.

<?php get_template_part( 'loop', 'search' ); ?>

If I use

<?php get_template_part( 'content', 'search' ); ?>

It returns with an error

enter image description here

Which I have no clue what it means.

What could be making the search function behave like this? It used to work. Any help is appreciated!


 * @package Toolbox
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
        <h1 class="title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    <?php if ( 'post' == get_post_type() ) : ?>
        <div class="entry-meta">Posted on: <?php the_time('F j, Y'); ?> </div><!-- .entry-meta -->
        <?php endif; ?>
    </header><!-- .entry-header -->
  • Can you paste the first 5 lines of the file "content.php" in your toolbox theme? – jessica Jun 18 '12 at 17:48
  • Yep. See updated question. – kia4567 Jun 18 '12 at 17:54
  • 1
    You didn't close your php tag after your comment. Add a ?> on line 5 before your <article> – Alex Lane Jun 18 '12 at 18:35
  • Thanks. I'll be sure to watch for simple mistakes like that. – kia4567 Jun 18 '12 at 20:56

You are missing the closing ?> php tag before the <article> tag.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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