I'm new to WordPress Development. I have a client I'm working with that uses a third-party plugin to curate search results (ElasticPress), however, they are looking for additional buttons on the search results page to sort everything by either name or date posted.
I've found a lot of answers on this topic that apply an action/filter to each query in functions.php... But I'm wondering how I can mimic that behavior without overriding all search queries. I just want that behavior if they press the sort button on the search results page, but everything else to use their custom search functionality.
How can I apply an action/filter conditionally on button press to do that? Any guidance is appreciated