• Hi I’m trying to load two authors for my site at a time. I also need them to be random from my list of authors. However, I don’t have them sitting right next to each other. Here is what I have so far. You’ll notice I’m making the same request twice. I know there has to be a better way. Any help would be greatly appreciated.

    <?php $uid = getUsersByRole( subscriber );
          shuffle($uid);
          array_rand($uid);
    
          for($someNumber = 1; $someNumber <= 1; $someNumber++) {
              $userID = $uid[$someNumber];
        ?>
    <a href="#" class="employee five columns alt-spacing captionfull bwWrapper item">
    	<?php userphoto($userID);?>
    	<div class="cover boxcaption">
    	     <figcaption><?php the_author_meta( 'display_name', $userID ) ?> | <span><?php the_author_meta( 'job_title', $userID ) ?></span></figcaption>
    	</div>
    </a>
    <?php
    }
    unset($uid,$userID);
    ?>
    
    <section class="text five columns alt-spacing">
        <?php the_content(); ?>
    </section>
    
    <?php $uid = getUsersByRole( subscriber );
        shuffle($uid);
        array_rand($uid);
    
    for($someNumber = 1; $someNumber <= 1; $someNumber++) {
        $userID = $uid[$someNumber];
    ?>
    
    <a href="#" class="employee five columns alt-spacing captionfull bwWrapper item">
          <?php userphoto($userID);?>
           <div class="cover boxcaption">
    	<figcaption><?php the_author_meta( 'display_name', $userID ) ?> | <span><?php the_author_meta( 'job_title', $userID ) ?></span></figcaption>
    	</div>
    </a>
    <?php
       }
    unset($uid,$userID); ?>
  • The topic ‘Load to authors without duplicating’ is closed to new replies.