Support

Account

Home Forums General Issues Problem sort ACF date field value in repeater/group

Unread

Problem sort ACF date field value in repeater/group

  • Hello,

    I have a problem with sorting an ACF Date Field Value, knowing that the date “$clients-domaine-daterenouvellement_2″is found in a group inside of a repeater

    clients-listeweb (repeater) —> gestion_domaine (group) —> clients-domaine-daterenouvellement_2 (the dates we want)

    add_shortcode( 'compte-date', function () {    
        $args = array(
            'post_per_page' => '10',
            'post_type'=> 'client',        
        );              
        
        $the_query = new WP_Query( $args );
         $date = date('d-m-y h:i:s'); 
        if($the_query->have_posts() ) : 
            while ( $the_query->have_posts() ) : 
                $the_query->the_post();           
                // Boucle acf
                if( have_rows('clients-listeweb') ):
                    while ( have_rows('clients-listeweb') ) : the_row();
                        $URL = get_sub_field('clients-siteweb');
                    if( have_rows('gestion_domaine') ): while ( have_rows('gestion_domaine') ) : the_row();  
                $dateRenouvellement= get_sub_field('clients-domaine-daterenouvellement_2'); 
       
                   //$html .= '<div class="">'.$URL.'</div>';
                   $html .= '<div class="">'.$dateRenouvellement.'</div>';
     
               endwhile; endif;        
                       endwhile;
                        
                endif;           
                    
                    endwhile; 
                wp_reset_postdata(); 
         
            endif;
        
        return $html;
        } );

    Actually i have this :
    https://www.pixenli.com/image/E_Gr-8Zj

    One circle color matches an object

    expected result:
    https://www.pixenli.com/image/heVRBe-g

    (a sort by date of the sub-elements and not of the parents)

    Any idea what is wrong with my code?
    Thx !

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.