afaik search query is posted in $_GET[‘s’] array. so in place whare you want to put search query use:
<?php
echo $_GET['s']; ?>
or if it is still with ‘+’, do this:
<?php
echo str_replace('+', ' ', $_GET['s']); ?>
That’s actually not displaying anything now.
Here’s what I’ve been using, although I’m not opposed to only using it for the search count functionality.
<?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">'); echo $key; _e('</span>'); _e(' — '); echo $count . ' '; _e('products'); wp_reset_query(); ?>
Still need way to remove the “+” sign though.
I don’t know, maybe my theme has a conflicting function or override of some sort. I tried both versions using the POST and I’m still showing nothing when I use that function.
The official documentation says to use this to show the query:
<?php the_search_query(); ?>
I’m now using this in the breadcrumb menu & using the previous script for the 2nd occurrence and the search count.
Still can’t get rid of the “+” though on either.
first off all: why i dont see your answers here but i got them in my mail box?
change:
the_search_query();
into:
function callback($buffer) {
return (str_replace(‘+’, ‘ ‘, $buffer));
}
ob_start(“callback”);
the_search_query();
ob_end_flush();
I honestly don’t know why you can’t see them. When I tried to post a reply yesterday it told me the post was closed… Weird stuff going on.
I can see this here, but all I got in the email was a “.”
Some posts may have been temporarily caught in Akismet’s spam bin.
@esmi, now i see everything 🙂
@chowell18, you see dot in email beacause i posted dot and after this i edited post to put (some test) 🙂
btw. does it work?
This question is still unresolved btw…. Anyone have a solution?