public
Last active

WP Author Page based on userextra filer

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<?php // display all users with usermeta 'featured_author' checked 'yes'
global $wpdb, $usermeta;
$featured_authors = $wpdb->get_results("
SELECT user.ID, user.user_nicename
FROM $wpdb->users user
", OBJECT);
// loop through authors
foreach($featured_authors as $featured_author) {
$curauthor = get_userdata( $featured_author->ID );
// select featured authors
$val = $usermeta->get($featured_author->ID, "featured_author", true);
if ($val == 'Yes'){
// featured authors attributes
$name = $curauthor->display_name;
endif;
{ ?>
<!-- Author Loop -->
<?php echo get_author_name($featured_author->ID)?>
<?php } } } ?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.