Support

Account

Home Forums Add-ons Repeater Field Display and shuffle all repeater sub fields of all posts

Helping

Display and shuffle all repeater sub fields of all posts

  • I am trying to build a portfolio website with a repeater field in the post-type and with a main page that displays all sub fields of all posts randomly. I have managed to make a page that does this, but I still don’t know how to shuffle all sub fields instead of shuffling the posts with ‘orderby’ => ‘rand’, which is still displaying the sub fields together per post.

    Is this possible?

  • Forgot to paste this:

    <?php
    $args = array (
        'post_type' => 'post',
        'posts_per_page' => -1, 
        'meta_key' => 'project', 
        'orderby' => 'rand',
        'meta_compare' => 'EXISTS' 		);
    
    $query = new WP_Query($args);
    
    while ($query->have_posts()): $query->the_post();
    		
    if (have_rows('project')) {
      while(have_rows('project')) {
      the_row();
      ?>
      
      <a href="<?php the_permalink(); ?>"><img src="<?php the_sub_field('image'); ?>"></a>
      
      <?php
      }
    }
    
    endwhile;
    
    wp_reset_query();	
    ?>	
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.