php - Update sub fields from repeater with different values in WordPress ACF


I'm trying to update 4 different sub fields from a repeater with 4 different values that i get from a json.

The thing is i'm able to update all the sub fields with a single value(the same for all 4 sub fields), but not with different values.

What I have is: (Sorry i dont know how to add php to the snippet)

Code Link: Link

I've created also an array of the different urls..

$counter = 0; if(have_rows('branch','option')): while(have_rows('branch','option')): the_row();

      $ch = curl_init();
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_URL, '');
      $result = curl_exec($ch);

      $obj = json_decode($result);
      $value = $obj->utc_offset; 
      update_sub_field('timezone', $value); ?>

        <div class="clock-wrapper" data-timezone="<?php the_sub_field('timezone'); ?>">

I have 4 different values I got from the URL:

How could I give to each sub field one of the values?

People are also looking for solutions to the problem: javascript - Inactive/browser close - change status to 0 and back to 1 when user returns


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.