I am trying to display all my site members info with avatar and some information in members page of my WordPress site.For this, I have written following code.It is displaying data with one single user in a row.What I am trying is to display multiple users like 4 to 5 members horizontally in a single row then start 2nd row similar like this https://stackoverflow.com/users Following is my code.how can achieve this
<?php
global $wpdb;
$result = $wpdb->get_results( "SELECT id,display_name as pt,user_registered as re FROM wp_users group by id"); /*mulitple row results can be pulled from the database with get_results function and outputs an object which is stored in $result */
foreach($result as $row)
{
echo '<table><tr>';
echo '<td>'.get_avatar( $row->id,40 );
echo '</td><td>'.$row->id." ".$row->pt. "<br>" .$row->re. "</td></tr>
</table>";
}
?>