0
[RESOLVED] I am selecting the compos id, user_nicename and display_name of the database, in this I create a foreach to show the result, but the right one would return me all users but returns the number of registered users, repeating the same user
<?php
global $wpdb;
$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name");
foreach ($authors as $authors ) {
$aid = $authors->ID;
?>
<div class="autor">
<div class="avatar"><?php $email = get_the_author_email(); $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($email). "&default=".urlencode($GLOBALS['defaultgravatar'] ); $usegravatar = get_option('woo_gravatar');?><img src="<?php echo $grav_url; ?>" alt="" width="80" height="80" /></div>
<div class="autorcontent">
<div class="nomeautor"><a href = "<?php the_author_url ();?>" itemprop="url"><?php the_author(); ?></a></div>
</div>
<div class="redesautor">
<div class="autorredes"><a href="<?php the_author_meta( 'instagramuser' ); ?>?rel=author" target="_blank"></a>
<?php if ( get_the_author_meta( 'instagramuser' ) ) { ?><a href="<?php the_author_meta( 'instagramuser' ); ?>?rel=author" title="siga o perfil no instagram" target="_blank"><i class="fab fa-instagram"></i></a><?php } ?></div>
<div class="autorredes"><a href="<?php the_author_meta( 'twitteruser' ); ?>" target="_blank"></a>
<?php if ( get_the_author_meta( 'twitteruser' ) ) { ?><a href="<?php the_author_meta( 'twitteruser' ); ?>" title="suia o perfil no Twitter" target="_parent"><i class="fab fa-twitter-square"></i></a><?php } ?></div>
<div class="autorredes"><a href="<?php the_author_meta( 'facebookuser' ); ?>" target="_blank"></a>
<?php if ( get_the_author_meta( 'facebookuser' ) ) { ?><a href="<?php the_author_meta( 'facebookuser' ); ?>" title="siga o perfil no Facebook" target="_blank"><i class="fab fa-facebook-square"></i></a><?php } ?></div>
</div>
</div>
<?php } ?>
I haven’t dealt with PHP for a long time, but I wonder if the way you are passing the table in SELECT is actually working...
– GustavoAdolfo