wordpress-faq-manager
wordpress-faq-manager copied to clipboard
How to style search results to match?
If you do a search for FAQs (either using the widget or another search form) you get the standard WP search results.
I created a custom template for faq search results and was hoping there would be an easy way to style the results to match the main FAQ listings.
I tried adding a filter to the query args so I could pass 's' => get_search_query()
, but you're using get_posts()
which doesn't support the s
or post__in
parameters.
I ended up just copying the output and dropping it in the loop: https://gist.github.com/billerickson/482858f857d98b3a5a106af2142ce4f1
Is there a cleaner way to do this? Maybe breaking the output of the results into a separate function so it's accessible elsewhere. Or making the $faqs a parameter that can be defined in the shortcode (if not defined, use get_main_shortcode_faqs()
).