Support » Themes and Templates » Trouble creating search results page

  • I have my homepage set to a static page, and it’s confused me about how to set up a search results page!

    I have search.php like so:

    <?php get_header(); ?>
    <div id="span-sub">
    	<span class="title">THE WORLD'S ONLY PAINLESS LASER HAIR REMOVAL</span>
    	<p>Right for you... Painless, faster, safer, more cost effective, often outperforming other lasers. For every part of your face and body.</p>
    </div><!--end span-sub-->
    <?php include(TEMPLATEPATH . '/include/cta-btn.php'); ?>
    <div id="page">
    	<div id="content">
    		<?php if(have_posts()) : ?>
    			<?php while(have_posts()) : the_post(); ?>
    				<h1>Results for '<?php the_search_query(); ?>'</h1>
    				<?php the_content(); ?>
    			<?php endwhile; ?>
    		<?php endif; ?>
    	</div><!--end content-->
    	<?php get_sidebar(); ?>
    <?php get_footer(); ?>

    And here’s what searchform.php looks like:

    <form method="post" action="<?php bloginfo('url'); ?>" id="searchform">
    		<input type="text" name="s" value="Search The Site" />
    		<input class="frm-btn" type="submit" name="frm-search-submit" value="" />

    But whenever I perform a search, I am just taken to a blank page. I am not even shown the h1 tag; “<h1>Results for ‘<?php the_search_query(); ?>'</h1>”

    I think the page is sending me to the homepage, but that can’t display the results because it’s just a static page!

    Do I just need to update the ‘action’ attribute of the form?


  • The topic ‘Trouble creating search results page’ is closed to new replies.