• Resolved Bryce Corkins

    (@sekatsim)


    I need to do some fancy stuff with the search results. Basically, I’m querying a bunch of media items by taxonomy, but I need to display “Artists” who have been associated with those media items through an ACF field. Difficult client, long story.

    Anyway, I’m totally comfortable with building this query, but I’m not sure what the best possible way to integrate with your plugin is. Is there some kind of hook/filter I could use to take the search query and modify the results before it’s returned? Or is there some template I could modify for the results page which grabs the query params from the URL and does it that way? Any pointers appreciated.

    https://www.ads-software.com/plugins/search-filter/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author DesignsAndCode

    (@designsandcode)

    Hey Bryce

    If your happy with modifying your query then it shouldn’t be a problem to integrate with this.

    So let me get try to get a better idea:

    1. you will build a search form using this plugin
    2. you want to modify the search itself to tweak the display of your results

    If this is correct, then all you need to do is hook in to pre_get_posts and modify you query.

    When it comes to filtering by taxonomy, this plugin does not make any modifications to WP_Query or any other query modification for that matter – it is wordpress that is actually doing the querying.

    As an example, if you went to a URL:

    www.yoursite.com/?color=brown

    Then this would show all items that are the color brown (where color is a taxonomy), this is with or without the plugin enabled, so you need to hook in to pre_get_posts, check whether the current page is a taxonomy page, and if so continue to modify the query

    Something like is_tax could do the trick – https://codex.www.ads-software.com/Function_Reference/is_tax

    Same for if you are using tags or categories and wanted to apply some custom modifications on those pages you would use something like is_category and is_tag

    Hope that helps??

    Thread Starter Bryce Corkins

    (@sekatsim)

    Beautiful, thank you. I’ll give it a try.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modifying results’ is closed to new replies.