Support

Account

Forum Replies Created

  • How can I add this snippet? I’m using the “Snippets” plugin but no additional field types are showing with this function added via snippets.

  • What did you do to get it to work? I’ve still not managed to get this to work at all.

  • Hmmm, I had tried it with quotes also. Either way, with or without the quotes, it reads the field OK and does the calculation as expected.

    I also read somewhere (forgotten where, amongst all the Googling!) that with date types, the field key should be used instead of the field name.

    Field name, field key, with and without quotes, the update field doesn’t seem to write data and the field remains blank.

    I tried also adding $post_id too, although I believe this defaults to the current post anyway.

    $reviewDate = get_field('document_review_date');
    $remindDate = date("Ymd", strtotime($reviewDate . '-7 days'));
    update_field('field_60f4466dcddc8', $remindDate, $post_id);
  • Just jumping on this for advice.

    I’m trying to calculate a date (review date – 7 days = reminder date)

    so I have 2 ACF fields:
    – document_review_date
    – document_review_date_reminder_trigger

    In my function, I have:

    $reviewDate = get_field(document_review_date);
    $remindDate = date("Ymd", strtotime($reviewDate . '-7 days'));
    update_field(document_review_date_reminder_trigger, $remindDate);

    $remindDate is returning the correct calculated date.

    However, it doesn’t seem to be updating my ACF field as it is not shown in the field in the post editor.

    What am I doing wrong here?

  • Here’s another field form I’m having the same issue with… great layout until I enter the first image.

  • Wow… the solution was SOOOOOO simple.

    I do not even need to add any code to my functions.php

    All I needed was to add the post_id=”options” to the shortcode.

    [acf field= "services_0_service-name" post_id="options"]

    The answer is always easier than you think!

  • Hi John,

    Thank you for pointing this out. I’ve added “option” to the IF statement too.

    However, I’m getting no data returned from my shortcode.

    So I have a repeater, “services” with sub-fields of “service-name”, “service-description-short” and “service-description-long”

    I just want the “name” and the “short description” so using the shortcode:

    [acf_repeater field="services"]
    service name: [acf field='services_1_service-name']
    service desc: [acf field='services_1_service-description-short']
    [/acf_repeater]

    What is displayed is:

    service name: service desc:

    It’s not populating with the data from my repeater second row (I’ve tried it with %ROW% 0 for the first row too, that’s the same result)

    What am I not getting?

  • How do I display a specific row in this updated version?

    [acf_repeater field="my-row" sub_fields="full-name,phone-num"]
    name: %full-name%
    phone: %phone-num%
    [/acf_repeater]

    I’ve been trying to work out where to add the %ROW% function in the code (like in the original code) but cannot get it to work correctly.

  • I’m using ACF Options so the data isn’t sourced from the page/post – I’m struggling to get the code to read the data from the options table. I’m just getting “Services does not have any rows” message.

    How do I specify to get data from the options table?

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