Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Display WordPress Search Query?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #40535
    Noel Forte
    Participant

    Hi-
    I have Google Custom Search set up on my website, and I want to display the search term at the top of the page. `the_search_term();` doesn’t work, as it’s trying to query “s”, but google custom search uses “q” as a term instead of “s”.

    I was able to get the search box to point to my search results page by changing the form action from `echo get_bloginfo(‘/’);` (which is the default), to `echo get_bloginfo(‘/search-results’);` which is my results page. I also changed the parameter `name=”s”` to `name=q`, which changes the query term in the URL from `?s=` to `?q=`.

    Now, as stated before, I’m trying to get the search term to display in the context of “Search Results: $term”, but no matter what I try it doesn’t seem to work.

    I did run across this snippet of code when doing some digging:

    but that doesn’t seem to change much, even after using `echo $g_search`, or `echo get_search_query`.

    Any suggestions on how to get this to work?

    #129701
    aldon
    Participant

    i have the same issue! any help???

    #129702
    Noel Forte
    Participant

    Yes, yes, I actually was able to solve this myself!!! I had posted the same question over at the wordpress.org forums. You can get to my original post [here](http://wordpress.org/support/topic/google-custom-search-query-string?replies=3 “the post on wordpress.org”); someone else besides you had this problem. It seemed like there weren’t a lot of responses on this post, so I forgot about it…lol. Anyways, glad to have helped you out.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.