WordPress.org

Support

Support » How-To and Troubleshooting » search works only on frontpage?

search works only on frontpage?

Viewing 3 replies - 1 through 3 (of 3 total)
  • nearlythere

    @nearlythere

    really interesting. i’d love to be able to do that (restrict search to current area). ;o) of course it’s not what you wanted!

    can you post the code you are using for the searchform.php of your theme?

    when yours is displayed in HTML i see an empty action:

    <form id="searchform" method="get" action="">

    when mine is displayed on my site i see this in the code:

    <form method="get" id="searchform" action="/index.php">

    this is the code from MY searchform.php…

    <form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    what’s yours?

    nearlythere found the problem. if no action is suplied, the browser uses the current url, which in your case includes the parameters that tell the server to display the category or single entry, what the server does. that’s the reason, it ignores your search request.

    if you provide index.php as action, it should work fine.

    wow, didn’t know that, bob58. The search restricted to a category or a given post would be helpful within the archive pages. Not sure how to make it work that a text above the field changes depending on the position of a visitor (i.e., monthly, year or category). Perhaps an if/else statement would do the trick.

    On individual post/pages only if the text is long enough and the searched text is marked with a color. Then again, FF does the same thing, so there’s no neccessity to duplicate this feature.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘search works only on frontpage?’ is closed to new replies.
Skip to toolbar