Forums

search box only goes to one page (5 posts)

  1. jaw23
    Member
    Posted 2 years ago #

    Help!

    I have added a search box to my new theme and no matter what I put in it and search, it takes me to the most current three blog postings.

    here's my searchform.php code:

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <input type="text" value="Search" onclick="value=''" name="s" id="s" />
    <input type="submit" id="searchsubmit" value="Search" />
    </form>

    Any thoughts?

  2. Mark / t31os
    Moderator
    Posted 2 years ago #

    Please do bump, you'll lessen the chances of a response in doing so on these forums.

    If your theme doesn't have a search.php, create one... it only needs the most basic of loops, and you're own HTML (relevant to your theme)..

    Here's a very basic example of the code to place into search.php

    <?php get_header(); ?>
    
    <?php if( have_posts() ) : ?>
    
    <?php while( have_posts() ) : the_post(); ?>
    
    	<h2><?php the_title() ?></h2>
    	<div class="content">
    		<?php the_content(); ?>
    	</div>
    
    <?php endwhile; ?>
    
    <?php endif; ?>
    
    <?php get_footer() ?>

    In short, it's just a regular loop..

    Without the search.php, your search requests are being dealt with by index.php, which you may have adjusted for other uses.

    Also see the default theme's search.php for a further example.

  3. jaw23
    Member
    Posted 2 years ago #

    perfect, thank you.
    but I don't know what you mean by 'bump.'

  4. Mark / t31os
    Moderator
    Posted 2 years ago #

    Your previous self-reply to the thread pushes you off the no-replies list which some of us (support volunteers) use to find threads that require a response, by replying to your own thread you remove the possiblity of being on that list.

    I updated your first post and removed the self-reply.

    If you've resolved your initial query though, then we need not worry about it anymore ... :) more a FYI for future postings...

  5. jaw23
    Member
    Posted 2 years ago #

    ok. thanks. and thanks so much for what you support volunteers do!

Topic Closed

This topic has been closed to new replies.

About this Topic