Forums Forums Search & Filter Pro acf repeater field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #17387

    I’m using acf repeater field to add multiple images upload fields. I want to add a checkbox to search & filter to filter only posts which have images.

    The repeater field uses the meta_key: photos, while child images fields uses meta_keys: photos_0_photo, photos_1_photo, photos_2_photo… etc.

    Ross Moderator
    #17391

    Hey Ahmed

    This is not supported with S&F directly.

    You could add a hidden custom field to your posts, which when saved will detect if there are any images in the post

    You could then use this custom field as an option in S&F to add this tickbox – something along the lines of:

    1) Detect when post is saved – https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

    2) Do some custom detection if images are attached to the post

    3) If so, update the post meta – https://codex.wordpress.org/Function_Reference/update_post_meta

    4) Use the Key you used in step 3 in a S&F “Post Meta” field.

    Thanks

    Anonymous
    #17394

    This is just a bit complicated to me.

    Every other acf fields is working fine for me though.

    Add the options that will be available to this field, each option must have a value and a label.

    Why can’t I choose a null value or when the value doesn’t equal?

    Ross Moderator
    #17431

    Hey Ahmed

    Basically I’m not sure if S&F really works with repeater fields – its not supported as its an extension for ACF so I would guess that without some customisations to the plugin it wouldn’t work right away…

    However if you want to show all posts that have a particular meta field set, then head to the “post meta” tab, theres ton of different queries you can setup and you can if check if fields exist.

    Be careful though, the values here stack (AND operator) with the meta fields in the search form itself.

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)