Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Blogging Forum


You are currently viewing our Blogging Forum as a guest. Please register to participate.
Login



Reply
Trouble creating search results page (Wordpress)
Old 07-19-2010, 04:39 PM Trouble creating search results page (Wordpress)
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
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 Code:
<?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:

Code:
<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.
__________________

Please login or register to view this content. Registration is FREE

Last edited by pealo86; 07-19-2010 at 04:40 PM..
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 07-23-2010, 03:24 PM Re: Trouble creating search results page (Wordpress)
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
You need to change the method to "get", not post. The database search query comes from that variable passed.

You're not seeing <h1> etc... because there are no posts found, technically.
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 07-23-2010, 10:43 PM Re: Trouble creating search results page (Wordpress)
iamobama's Avatar
Novice Talker

Posts: 10
Name: Pandora beads
Location: Pandora beads
Trades: 0
Quote:
Originally Posted by racer x View Post
You need to change the method to "get", not post. The database search query comes from that variable passed.

You're not seeing <h1> etc... because there are no posts found, technically.
Yes! I think so!!
iamobama is offline
Reply With Quote
View Public Profile Visit iamobama's homepage!
 
Old 07-24-2010, 09:47 AM Re: Trouble creating search results page (Wordpress)
pealo86's Avatar
Super Spam Talker

Posts: 876
Name: Matt Pealing
Location: England, north west
Trades: 0
Ahhh yes that was it! After hours of ripping my hair out I realised that the method was wrong haha.

Thanks anyway.
__________________

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Reply     « Reply to Trouble creating search results page (Wordpress)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21431 seconds with 12 queries