WordPress.org

Ready to get started?Download WordPress

Forums

search works only on frontpage? (4 posts)

  1. GrendelS
    Member
    Posted 8 years ago #

    Hi there,
    at http://grabic.name you'll find a search form in the sidebar. Enter "Croatia" und you'll get nine results. (http://www.iroke.de/wp/?s=Croatia). Now, from within a category (http://www.iroke.de/wp/category/art/) or a posting (http://www.iroke.de/wp/2005/06/01/k21-a-new-exhibition/) I can't search for the same term and get any results at all. Looks like the search form works only in the blog/category/post range, the deeper in the site, the less results? I.e. on the above mentioned post I get this (http://www.iroke.de/wp/2005/06/01/k21-a-new-exhibition/?s=Croatia) as a result, zarro posts found...
    How can I make the search form look for results all over the page?
    regards,

    Grendel

  2. nearlythere
    Member
    Posted 8 years ago #

    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?

  3. bob58
    Member
    Posted 8 years ago #

    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.

  4. GrendelS
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags