I’m trying to get the search term within a woocommerce page to display it dynamically on the results page so the user knows what term they searched on.
ex. “Showing results for $searchTerm”
Is there a way to get the search term from the page that was used?
2
Answers
I got this working through shortcodes by editing the functions.php file to include:
Then I could use
[searchterm]
as a shortcode on the page. Unfortunately I had to "touch" the php file.You can make use of the
get_search_query()
andis_search()
functions like this: