WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] My search works on home page but not sub pages (5 posts)

  1. kensavage
    Member
    Posted 6 years ago #

    This doesn't work.
    http://www.kensavage.com/index.php/contact-ken-savage/?s=+Polyphasic
    Comes up with a 404

    But this does:
    http://www.kensavage.com/?s=+Polyphasic

    I can see that it's the url but why doesn't this work on sub pages. Here's the code calling the search field:

    Search this site:<?php include(TEMPLATEPATH . '/searchform.php'); ?>

    and the include:

    <form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    		<input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
    		<input type="submit" id="searchsubmit" value="Go" />
    </form>
  2. kensavage
    Member
    Posted 6 years ago #

    anyone have any ideas?

  3. kensavage
    Member
    Posted 6 years ago #

    Is this correct?

    <?php include(TEMPLATEPATH . '/searchform.php'); ?>

  4. moshu
    Member
    Posted 6 years ago #

    That one is correct.
    Some servers, however, don't work well with this:
    action="<?php echo $_SERVER['PHP_SELF']; ?>"

    Try a newer version of the searchform file, e.g. from the latest default theme.

  5. kensavage
    Member
    Posted 6 years ago #

    that did it Moshu.

    I changes the search.php file to:

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

Topic Closed

This topic has been closed to new replies.

About this Topic