Again the answer came pretty soon after posting this thread. I couldn’t delete it, so therefore the answer. OF COURSE this is easy practice and all I had to do is to set Conditional Login in the Enddate/time to Yes. Here I could select the condition from Field B. If all is implemented and working correct, I’ll post the fix here.
Sometimes, the solution is lying right in front of you and is it better to replace instead of repair. I replace the query with the one from Query posts (now) and all is working as it should.
Thanks to the suggestion bij Deej on this thread I managed to work this out.
$repeater = get_field('recensie');
foreach ($repeater as $key => $row) {
$recensent[$key] = $row['recensent'];
$recensent_functie[$key] = $row['recensent_functie'];
$recensent_link[$key] = $row['recensent_linkedin'];
$recensent_foto[$key] = $row['recensent_foto'];
$recensent_tekst[$key] = $row['recensie_tekst'];
$recensie_type[$key] = $row['recensie_type'];
}
array_multisort($recensie_type, SORT_ASC, $repeater);
foreach( $repeater as $row ) {
// styling for each field
} ?>
Thank you for the reply and sorry for the delay in answering. Nevermind the properties (like key) of the layout object look different, the idea of looping through the subarray was indeed what did the trick. With help from a friend who’s a PHP veteran, the following loop gave the wanted values.
To loop through all items at once:
<?php
foreach($content['layouts'] as $layout) {
echo 'layout: ' . $layout['label'] . '<br>';
foreach($layout['sub_fields'] as $subField) {
echo 'field: ' . $subField['label'] . '<br>';
}
}
?>
To put the item on the right spot, it’s necessary to point to the right index-number of the subarray.
So for example (using the loop from the question), this worked for Highlights with index 1:
<?php elseif(get_row_layout() == "highlights"): ?>
<?php echo $content['layouts'][1]['sub_fields'][0]['label']; //highlights ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.