WP - display author/title/avatar by posd id

4 replies
How can I display the author, title, and avatar of a post by id number?

Note:
I want to display these elements of several DIFFERENT posts in one page.

Thanks in advance for any help!
#author or title or avatar #display #posd
  • Profile picture of the author ndesoo
    you can use function the_author(); in loop.
    thie function display the author name by post-id parameter. but you should put it in a loop.
    {{ DiscussionBoard.errors[6460944].message }}
  • Profile picture of the author adamgoldman47
    Figured it out.

    In case nayone needs it:

    <?php
    $post_id2 = get_post_meta($post->ID, 'bottom_img_excerpt1', true);
    $queried_post = get_post($post_id2);
    $author_id = $queried_post->post_author;
    $user_info = get_userdata($author_id);
    $first_name = $user_info->first_name;
    $last_name = $user_info->last_name;
    echo get_avatar($author_id);
    $title = $queried_post->post_title;
    echo '<strong>' . $title . '</strong> <br />';
    echo "$first_name $last_name";
    ?>
    {{ DiscussionBoard.errors[6461865].message }}
    • Originally Posted by adamgoldman47 View Post

      Figured it out.

      In case nayone needs it:

      <?php
      = get_post_meta(, 'bottom_img_excerpt1', true);
      = get_post();
      = ;
      = get_userdata();
      = ;
      = ;
      echo get_avatar();
      = ;
      echo '<strong>' . . '</strong> <br />';
      echo " ";
      ?>
      Thanks.Thats great information.
      Signature
      {{ DiscussionBoard.errors[6467146].message }}

Trending Topics