Skip to content
Create a gist now

Instantly share code, notes, and snippets.

List just co-authors with thumbnail
<?php
$args = array( 'post_type' => 'guest-author', 'numberposts' => -1, 'orderby' => 'title', 'order' => 'ASC' );
$guest_authors = get_posts( $args );
foreach( $guest_authors as $ga ){
echo '<div class="contributor">';
echo get_the_post_thumbnail( $ga->ID, 'thumbnail', array( 'class' => 'alignright' ) );
$username = get_post_meta( $ga->ID, 'cap-linked_account', true );
if( $username ){
$user = get_user_by( 'login', $username );
$url = get_author_posts_url( $user->ID, $user->user_nicename );
echo '<a href="'.$url.'"><h3>'.$ga->post_title.'</h3></a>';
}else{
echo '<h3>'.$ga->post_title.'</h3>';
}
echo '</div>';
}
@irenefdez

Nice!
I have the list and the image, but not the link to author's page. Can you help me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.