Support

Account

Home Forums General Issues Shortcode of datepicker within repeater field

Solving

Shortcode of datepicker within repeater field

  • Is there a shortcode to output the date selected in the date picker subfield?

    The output format should be ‘d F Y’

    My repeater field is called course_dates
    My date picker subfield is called start_date

    Someone can help me out?

  • There isn’t a shortcode that is built into ACF that will work with repeater sub fields. The ACF shortcode is only meant for simple field types.

    https://www.advancedcustomfields.com/resources/shortcode/

    Generally for more complex fields you must built your own shortcode http://codex.wordpress.org/Shortcode_API

    There might be a way to use the ACF shortcode, please note that I have never tried this and it may not work and it is a hack. It also requires knowing the index (row) of the field you want to show.

    The meta key for a repeater sub field is constructed "{$repeater_name}_{$index}_{$sub_field_name}"

    So if you wanted to show the field on the first rows you might be able to use
    [acf field="repeater_name_0_sub_field_name"]

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

You must be logged in to reply to this topic.