Forums › Forums › Search & Filter Pro › Set parameter via shortcode? eg [searchandfilter id="7" show="results" q="term"]
Tagged: shortcode query parameters, V3
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by Trevor.
-
Anonymous(Private) December 13, 2018 at 1:22 am #196136
Hello,
I am wanting to tidy up the search url structure for some pages that perform a limited range of searches.
I want the search parameter to be determined by the url, read and processed in php then passed to the searchandfilter shortcode as a query.
for example: http://example.com/page/<dynamic_search_term>/
The search and filter results are called via a shortcode as follows:
<?php echo do_shortcode(‘[searchandfilter id=”2573″ show=”results”]’); ?>
How can one inject the query parameters into the shortcode? e.g.
[searchandfilter id=”2573″ show=”results” query=”abcd”]
Have not been able to find this in the documentation.
Thanks for your help.
DonTrevor(Private) December 13, 2018 at 11:32 am #196155I am afraid that what you want to do is not currently possible via a shortcode. Our plugin uses javascript to read the search parameters from the URL and then processes that. I am not sure how V3 of our plugin will do this, but it will be different.
Anonymous(Private) December 14, 2018 at 12:58 am #196305Hi Trevor,
OK, so maybe I need to intercept the search query parameter on the server side prior to the search?
That way, the javascript could read one thing in the url, send the request to the server, which (re-)interprets/rewrites the search parameter prior to the query being submitted.Would this work? How would I do this?
Thank you,
DonTrevor(Private) December 14, 2018 at 11:57 am #196351Modifications to the query can be made using the Edit Query Arguments filter.
-
AuthorPosts