Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
602 views
in Plugins by

I'm trying to create a widget that will appear on the search result page on my Q2A site.

For example if a user searches for "plugins" I want my widget to display the word "plugins"

But currently, in my output_widget function, the $request parameter only returns the string "search" but not the search query (which is what I am looking for)

If someone could help me get the search query in the widget I would really appreciate it. Thanks!

Q2A version: 1.7.4

2 Answers

+3 votes
by
selected by
 
Best answer

Just access the value from the PHP GET array. The Q2A way to do this is: qa_get('q')

+1 vote
by

I think I may have solved my own problem. Looking at the functions page I saw the function qa_self_html() using this I get ./?qa=search&q=search+query+here 

From here I will just take the substring and manipulate the string in order to get the search query.

I know this isn't the best way to approach this, so if anyone knows a better way to do this please let me know

...