Viewing 4 replies - 1 through 4 (of 4 total)
  • I think this will work.

    Previous:

    <?php
      $get_previous_post = get_next_post();
      echo get_wp_user_avatar($get_previous_post->post_author, 96);
    ?>

    Next:

    <?php
      $next_post = get_next_post();
      echo get_wp_user_avatar($next_post->post_author, 96);
    ?>

    Thread Starter screener13

    (@screener13)

    Thank you, that worked!

    Although, I did have to add ‘true’ as a variable of get_next_post for some reason. Like this:

    <?php
          $get_previous_post = get_next_post(true);
          echo get_wp_user_avatar($get_previous_post->post_author, 96);
    ?>
    <?php
          $next_post = get_next_post(true);
          echo get_wp_user_avatar($next_post->post_author, 96);
     ?>

    Thank you again for the help and thank you for a terrific plugin!

    I just noticed a typo in my previous example. Perhaps you already caught it but it should be something like this instead:

    <?php
      $previous_post = get_previous_post();
      echo get_wp_user_avatar($previous_post->post_author, 96);
    ?>

    According to the function reference, adding true means that it looks for a post in the same category. By default it’s false.

    Thread Starter screener13

    (@screener13)

    Ah, that makes sense. I was using this in a specific category. I guess that anyone not using it in a specific category could leave that blank to default to false. Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display avatar of next/previous post’ is closed to new replies.