Hey Ross:
I’m stuck in my attempt to create a custom search results page that displays only the title for the post(s) that are queried. I also want the “title” of the results page to state the number of results and the search query. Hoping you (or someone) can help?
I created a custom search.php file -> “searchpage.php”
I utilized the following code:
<?php if (have_posts()) : ?>
<h2 class="search-title">
<?php echo $wp_query->found_posts; ?> <?php _e( 'Search Results Found For Your Location' ); ?>: "<?php the_search_query(); ?>"
</h2>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?>>
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
<?php endwhile; ?>
<?php else : ?>
<h2 class="center">No posts found. Try a different search?</h2>
<?php get_search_form(); ?>
<?php endif; ?>
** First – The results page title is not showing the query name – only the number of results.
Q: Do I need to use something other than “the_search_query” to display the title?
** Second – The results page is not showing the header, menu, or results navigation. It is a plain white page that displays only the title, and post titles (hyperlinked).
Q: Any idea what is missing so the normal layout displays?
Thanks