Support

Account

Home Forums Add-ons Repeater Field Search query in repeater field Reply To: Search query in repeater field

  • Hi @matthieu82

    Just to clarify, you are asking how to find the row of data which relates to the current taxonomy and the current time.

    Am I right in assuming that the ‘current taxonomy’ will be found by viewing the taxonomy single page, via it’s permalink?

    This can be done it 2 steps.

    The first is to load the repeater data, which you can do via the have_rows function. Please see the docs here: http://www.advancedcustomfields.com/resources/functions/have_rows/

    Please note that because this is data for a taxonomy term, you will need to specify the post_id like so: http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/

    Once you have a loop working, you shouls attempt to print out each loops day and time data.

    Your next step will be to add some logic WITHIN the loop to determin if the current row matches the current time. You can get the current time in PHP via the time, or date function. Please use google to find docs on how to get the current time in different formats.

    You can then simply compare the sub field values (get_sub_field) with your current day / time variables and allow the loop to render the row, or use ‘continue’ to skip the row.

    Hope that helps.

    Thanks
    E