Support

Account

Home Forums Add-ons Repeater Field Formatting string from date picker

Helping

Formatting string from date picker

  • This may be really simple, but I’m new to PHP. I need to grab a sub field within a repeater field and format it. It’s a date picker sub field so I think it’s just a matter of creating a variable that is the sub field and then echo’ing a certain format. Can’t figure it out. Any help would be appreciated. Thanks

  • Hi @jeffhogg11

    No worries. You can use a function called get_sub_field to return a value and store it in a variable like so:

    
    $date = get_sub_field('field_name');
    

    Please note that the get_sub_field must be used WITHIN a has_sub_field or have_rows loop.

    Please check out the docs for loop examples, and also the date picker field to see how you can format the string

    Thanks
    E

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

The topic ‘Formatting string from date picker’ is closed to new replies.