Author Template: Number of posts with a custom field's specific value (1 post)

  1. mwro
    Posted 3 years ago #

    I am preparing my author.php. I would like it to display the following values:
    - the author,
    - the avatar,
    - the total number of author's posts,
    - the number of author's posts with a specific value of a custom field.
    Currently my code looks like this and it shows the author's name, the avatar and the total number of posts. Regarding the total number of the author's posts, I am not sure if the code is correct but the fact is that it works.

    Any idea how to call the last value - the number of posts by the author with one specific value of a custom field? (after the code goes the loop)

    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    <div id="author-highlight">
    <div class="small-author">author: </div>
    <div class="curauth"><?php echo get_avatar($curauth->user_email); ?>
    <?php echo $curauth->user_firstname; ?> <?php echo $curauth->user_lastname; ?></div>
    number of posts: <span class="nbr-author"><?php echo number_format_i18n( get_the_author_posts() ); ?></span>

Topic Closed

This topic has been closed to new replies.

About this Topic