WordPress.org

Ready to get started?Download WordPress

Forums

Trouble creating search results page (1 post)

  1. pealo86
    Member
    Posted 3 years ago #

    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">
    	<div>
    		<input type="text" name="s" value="Search The Site" />
    		<input class="frm-btn" type="submit" name="frm-search-submit" value="" />
    	</div>
    </form>

    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?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic