This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Programatically adding filters

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Programatically adding filters

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #56599
    milena_u6jmmilena_u6jm
    Participant

    Hey Ernest & team.

    I would like some guidance on the best practices for setting up some custom filters. If you could help us with some basic structures of how to best achieve what what need, that would be super helpful.

    Index:
    Our index is of all media items, but filtered to only index items with an ACF value of true for a field called available, you have helped set this up with another ticket. I am indexing all the ACF fileds that we need for the following filters. These fields are:
    – artistID
    – price
    – size_height
    – size_width

    Filters:
    We have to create 3 filters programatically, as they are custom, but if theres a way to do them another way, please let me know. I have hacked together some of them with LLM code, but I would rather build from scratch with your help.

    I noticed that if I didnt add and hide at least one filter in the UI, these new ones wouldnt show at all, so we do this, but seems clunky?

    Filter 1 – Artist name (kinda working but hacky)
    – each artwork should have an ACF artist_id field
    – we need to collate the artist list that has available works list, build a checkbox list, and then filter to just show artworks available from that artist

    Filter 2 – Price range (kinda working but hacky)
    – each artwork has a price, and we have a preset list of price ranges to limit results to certain ranges

    Filter 3 – Size
    – each artwork has a height and width
    – we want to have two range sliders where someone can set the min/max size, and then click to apply the filter to the results

    If you could offer some help in getting these set up a proper way, that would be amazing.

    Thanks everyone.

    #56616
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Well, these are indeed very specific, but it entirely depends on how these are implemented.

    I recommend looking at the frontend filters API. That contains information on how to add/alter filters on the search settings list.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.