Pass search parement through link

Open
REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme August 13, 2019
Login to reply
Alex Brown
4 years ago

that works thanks!!

Igor Sunz Support Agent
4 years ago

If you are looking for code how to get search query from search result page, here is code

<?php $s = get_search_query();?>

Alex Brown
4 years ago

usually in php i have used $s to show the variable, I found it in the
search string on top in the url is has s= so if i put
https://www.primaryarms.com/search?keywords= what is missing in the
simple how do i get simple to appear after the keyword= there should be
some echo code or variable code i can use to place the variable in my string

Igor Sunz Support Agent
4 years ago

http://rewise.wpsoul.net/?s=simple

where "simple" is your keyword

Igor Sunz Support Agent
4 years ago
What is $s and where did you find it?
Alex Brown
4 years ago

if i want to pass that same search term to another site - I can place
the logo on the side of the page and link to
https://www.primaryarms.com/search?keywords=
search what i am
trying to ask is what do i place in the keywords= part to make it show the
keyword I have tried to put https://www.primaryarms.com/search?keywords=
$s put it is not
passing the search term through the URL

Igor Sunz Support Agent
4 years ago

It's still not clear for me

If you want to show search results, for example, for word "simple", use link 

http://rewise.wpsoul.net/?s=simple&post_type=product&product_cat=

or 

http://rewise.wpsoul.net/?s=simple

if you want to show posts and not products

Alex Brown
4 years ago

I see the variable in the string but how do i pass it to the next site I
have placed a logo in the footer i want to pass the search term through the
url when the user clicks the footer so the link should be something like
href htpp://www.site.com?s=$searchterm

what is the code i place on the link so that it will pass the same term
that it is showing results for

Igor Sunz Support Agent
4 years ago

Not clear which site you mean. Explain, please

Alex Brown
4 years ago

how do I pass that variable to next site ???

Igor Sunz Support Agent
4 years ago

add any search form on site in header or in any place. Then, search
something. You will be redirected to page of search results

http://rewise.wpsoul.net/?s=simple&post_type=product&product_cat=

Alex Brown
4 years ago

I want to send the search parameter through a link to the partner site - Example user searches for "computers" I want to be able to place the logo of the merchant on the site and when user clicks it will go to   http://www.tagetwebsite.com?seacrch=computers

How do i create the URL and include the search term inside of it like i did in the above example