• Quick question:

    I am using Advanced Custom Fields for my author.php template. Problem is, co-authors get the values of the author instead of their own. This is my code:

    <?php echo implode(', ', get_the_author_meta('custom_field_one')); ?>
    <?php echo implode(', ', get_the_author_meta('custom_field_two')); ?><br><br>
    <?php echo implode(', ', get_the_author_meta('custom_field_three')); ?>

    What should be the correct alternative to get the co-author’s meta value?

    Please help!

    https://wordpress.org/plugins/co-authors-plus/

Viewing 1 replies (of 1 total)
  • Here’s an example of a loop that will return featured image, some of the built-in fields, plus a custom field (named author_ad_bottom in this example).

    <?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);
    echo "<br><br>";
    endforeach;
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Custom fields in author.php’ is closed to new replies.