Displaying Authors and then Ordering by meta_value
-
Hi Guys,
I am using wordpress to create a website for a company, they need to have a section for showing off the staff members, those staff members need to be shown in a specific order, so I have added an extra meta value to the user profile called ‘profile_order’… I have checked phpmyadmin and the data has saved correctly to the user_meta table.
What I am trying to do is call the id of all the users and then sort those via my extra ‘profile_order’ field that I have added… see below for my code… I have tried and tried and tried, but cant see anything that will let me do this ??
<?php $wp_user_search = new WP_User_Query(array( 'fields' => 'ID', 'order' => 'profile_order')); $editors = $wp_user_search->get_results(); print_r($editors); foreach ($editors as $editor) { ?> <div class="staff-member"> <h1><a href="<?php bloginfo(url); ?>/author/<?php the_author_meta( 'user_login', $editor ); ?>"><?php the_author_meta( 'first_name', $editor ); ?></a></h1> <p><?php the_author_meta( 'user_description', $editor ); ?></p> <?php echo get_avatar( $editor); ?> <?php the_author_posts_link(); ?> </div> <?php } ?>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Displaying Authors and then Ordering by meta_value’ is closed to new replies.