1

I currently have the following php code which gives me a list of all the current WordPress authors, including their name and avatar.

<?php
    printf('<h1>%s</h1>', the_title());
    foreach($users as $user)
    {
        ?>
        <div class="author">
            <div class="authorAvatar">
                <?php echo get_avatar( $user->user_email, '128' ); ?>
            </div>
            <div class="authorInfo">
                <h2 class="authorName"><?php echo $user->display_name; ?></h2>
            </div>
        </div>
        <?php
    }
 ?>

I'm looking for a way to put this information in a 3 column grid that is setup like the following.

<div class="section group">
 <div class="col span_1_of_3">
  This is column 1
 </div>
 <div class="col span_1_of_3">
  This is column 2
 </div>
 <div class="col span_1_of_3">
  This is column 3
 </div>
</div>

The problem I'm facing is how to properly fill out the col span_1_of_3 with each author that the php code generates. Any ideas would be appreciated.

0

Definitely over thinking it

<div class="section group">
<?php
    printf('<h1>%s</h1>', the_title());

    foreach($users as $user)
    {
        ?>
        <div class="author">
            <div class="col span_1_of_3">
                <div class="authorAvatar">
                    <?php echo get_avatar( $user->user_email, '128' ); ?>
                </div>
                <div class="authorInfo">
                    <h2 class="authorName"><?php echo $user->display_name; ?></h2>
                </div>
            </div>
        </div>
        <?php
    }
 ?>    
 </div>
  • Is this the answer? Or meant to be an edit to your question? – Tim Malone Jul 7 '16 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.