Viewing 2 replies - 1 through 2 (of 2 total)
  • To do so, I have removed all the avatar calls that use the guest author email and instead use a featured image for each guest author. I call the featured image (and some of the other tags) like this:

    <?php
    $coauthors = get_coauthors();
    foreach( $coauthors as $coauthor ):
    echo "author URL: ". get_author_posts_url( $coauthor->ID, $coauthor->user_nicename );
    echo "<br>thumbnail: ". get_the_post_thumbnail( $coauthor->ID, array(120,120), array('class' => 'avatar'));
    echo "<br>Display name:". get_post_meta($coauthor->ID, 'cap-display_name', true);
    echo "<br>website: ".$coauthor->website;
    echo "<br>description: ".$coauthor->description;
    echo "<br>custom field ". get_post_meta($coauthor->ID, 'author_ad_bottom', true);
    endforeach;
    ?>

    That last one is a custom field named “author_ad_bottom.” To enable custom fields for the guest-author post type, add this to your theme’s functions.php:

    add_post_type_support( 'guest-author', 'custom-fields');

    The first code above is a foreach() loop, so it will run through that list for each assigned author. If you’re just using one author (I’m using this plugin to easily assign syndicated columnists as authors without needing separate user accounts), then skip the foreach() and just grab the first value in the #coauthors array like $coauthors[0]->ID.

    Thread Starter ElHondo

    (@elhondo)

    Wow… Looks promising. I will give it a try.

    Thanks alot gdfwilliams!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Photo for the Guest Author’ is closed to new replies.