@dkeys222 I have the exact same issue. How do display only 1 row. now it returns the correct result but multiplied with the rows count. For example if i have 10 rows in the repeater, it returns the correct result but 10 times. have you worked it out?
@acf-support
Hello @leem2209 ,
I’m trying to achieve the same. The problem is that if i have 10 entries in my repeater, then i get as output the correct result x 10 times. how do you limit to get the output only once and not multiplied by the repeater rows?
Nevermind. Fixed it.
Hello,
How did you make that work? I used your code for a similar function but i cannot get it to work.
My case is that we have 2 Post Categories. 1. Upcoming Events and 2.Passed Events.
We create a post with ACF event_end_date which is an ACF Date picker. What we need to do is have a cron job that checks if the event_end_date has passed so it updates the Post Category from Upcoming Events to Passed Events. I just cant make it work. Here is the code if you guys got any input i would be thankful!
/* Scheduled Action Hook */
function check_event_end_date() {
global $post;
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category__in' => array(33), /*Upcoming Events Category ID*/
'posts_per_page' => -1,
);
$listings = get_posts( $args );
foreach($listings as $post) : setup_postdata($post);
$today = date( 'Ymd' );
$expire = get_field( 'event_end_date', false, false );
if ( $expire > $today ) :
$post_categories="36"; /*Passed Events Category ID*/
$append=false;
wp_set_post_categories( $post_ID, $post_categories, $append );
endif;
endforeach;
}
// Schedule Cron Job Event
if ( ! wp_next_scheduled( 'event_end_date_cron_job' ) ) {
wp_schedule_event( date( 'Ymd' ), 'daily', 'event_end_date_cron_job' );
}
add_action( 'event_end_date_cron_job', 'check_event_end_date' );
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.