Support

Account

Home Forums Front-end Issues order by sorting in relationship field Reply To: order by sorting in relationship field

  • Try this:

    <?php 
        // Query Arguments 
        $ids = get_field('relationship_name', false, false);
        $args = array(
           'post__in' => $ids,
           'orderby' =>  'post__in' 
        );	
                
        // The Query
        $the_query = new WP_Query( $args);
        
        // Check if the Query returns any posts
       if ( $the_query->have_posts() ) {
          php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
          <h1><?php the_field('postField_name'); ?></h1>
    
       <?php endwhile;  } ?>