Support » Fixing WordPress » Search function only works in site root?

  • Hi Guys

    My site:
    My Theme: Webfolio
    My (relevant) plugins: Search everything and YD Search Functions

    To distinguish between the terms web pages and WP pages I will write WP pages as page.

    My problem is that my theme’s search form (which, I believe, uses the native search) only works correct in the site root.

    In the site root the search works perfectly and also displays results from all of my pages. In the blog index it displays “Sorry but you are looking for something that isn’t here” if I search for something which I know is on a page. However, if I on the index page instead search for something I know is in one of my blog posts that post is served as a single result on the blog index page… But it doesn’t display as a search results page – just as the index page with less results.

    When the current page is a blog post or a page and I search for something not in that post/page the URL changes again but this time the page loses it content – nothing is displayed besides the header and footer. If I instead search for something that is in the post/page – the content just remain displayed and the URL gets the search parameter added.

    I am very satisfied with the way the search works in the site root – but why doesn’t it work like that on the entire site?

    Does anyone have any idea what is missing or what I need to do to make the search work as it should on the entire site?

    Thanks in advance
    Esben Rasmussen

Viewing 2 replies - 1 through 2 (of 2 total)
  • Ok… One step closer to solving it.

    I changed the search form my theme was using to <?php get_search_form(); ?>. Now the search works fine no matter where you search on the site.

    But the problem is, that when using <?php get_search_form(); ?> it redirects the URL to the site root and appends the search parameters.

    Is it possible to avoid the redirection?

    The reason why I would profer to keep the URL is so that I via Google Analytics can track which page people were visiting, when the search occured (which indicates that, that page might be missing some info on the searched subject).

    If the URL changes I can no longer as easily track where the search occurred.

    I modified the header file where it says

    <form id="searchform" action="" method="get">
    <input id="s" type="text" name="s" value=""/>
    <input id="searchsubmit" type="submit" value=""/>

    Change the action=”” to action=””

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Search function only works in site root?’ is closed to new replies.