WordPress.org

Forums

Search location (11 posts)

  1. lawtai
    Member
    Posted 10 years ago #

    On my site, the search works fine when you're on my "home" view. However, when you go onto a page that I created, the search seems to fail. How can I get it so that if I'm trying to search on a page instead of my main page, it'll search the main pages?

    I think it has something to do wtih the fact that I'm now in www. myurl.com/pages/ instead of www. myurl.com so it can't search properly. Anyone know how I can fix this? Thanks!

  2. Kafkaesqui

    Posted 10 years ago #

    Go into the search's form tag (in page.php if you're using this for your Pages template) and change the action value to:

    action="/"

    or:

    action="/index.php"

  3. lawtai
    Member
    Posted 10 years ago #

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

    is what I had before, after changing the action to "/" or "/index.php" the search function breaks.

    My search function is located in my sidebar.php file which is called on by everything.

  4. Kafkaesqui

    Posted 10 years ago #

    Hmm. The action attribute just points to the file/script the search is to occur off of, which for WordPress is index.php. So using "/" or "/index.php" *should* be all one need do...

    I just tried this in the default theme (which also has search in the sidebar, but loads the search form from searchform.php) on a test site with no problems.

  5. lawtai
    Member
    Posted 10 years ago #

    hmm, i'm currently using a "search.php" page for my searches to show up, coudl taht be affecting it at all?

  6. Kafkaesqui

    Posted 10 years ago #

    Mayhaps. Does pointing the action value at search.php work?

  7. lawtai
    Member
    Posted 10 years ago #

    heh, i tried /search.php and that didn't work, and then tried /wp-contents/themes/taibros/search.php and that didn't work iether.

  8. Kafkaesqui

    Posted 10 years ago #

    Ok...what's in search.php? Is there a WP loop for the posts to display? As I noted above, I had no difficulty resetting the action, so I'm not sure why you're running into a problem.

  9. lawtai
    Member
    Posted 10 years ago #

    my search.php file basically redirects to my archives.php file which just tells it how I want it to show up.

  10. lawtai
    Member
    Posted 10 years ago #

    weird, i just tried /index.php even though I know I tried it before with itnot working, and it worked. Thanks for the help!

  11. vono
    Member
    Posted 9 years ago #

    Thanks for the help on this. Make sure you edit where it appears on the page vs the searchform.php

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.