No Display of Search Results
-
I’m working on a custom WP template from scratch and I’m currently trying to customize the search results page (search.php).
I’m using the code below which was taken from the default “twentyten” theme’s search.php page.
When I search for a few terms, the search.php pulls up and shows that it has found results, but it doesn’t output any of the actual results..
I noticed that the search is dealing with the loop, but not sure where the code if for that search loop?
Any help directing me to things?
<?php if ( have_posts() ) : ?> <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyten' ), '<span>' . get_search_query() . '</span>' ); ?></h1> <?php /* Run the loop for the search to output the results. * If you want to overload this in a child theme then include a file * called loop-search.php and that will be used instead. */ get_template_part( 'loop', 'search' ); ?> <h2>Displaying <?php $num = $wp_query->post_count; if (have_posts()) : echo $num; endif;?> of <?php $search_count = 0; $search = new WP_Query("s=$s & showposts=-1"); if($search->have_posts()) : while($search->have_posts()) : $search->the_post(); $search_count++; endwhile; endif; echo $search_count;?> Results</h2> <?php else : ?> <div id="post-0" class="post no-results not-found"> <h2 class="entry-title"><?php _e( 'Nothing Found', 'twentyten' ); ?></h2> <div class="entry-content"> <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyten' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </div><!-- #post-0 --> <?php endif; ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘No Display of Search Results’ is closed to new replies.