<?php while ( have_posts() ) : the_post(); ?>
<section class="panel panel-white">
<div class="row single-post-content">
<?php if ($category_name !== 'Jobs') { ?>
<h5 class="author-post__title"><?php the_author() ?></h5>
<p><?php echo get_the_date(); ?></p>
<?php }
the_content();
if ($category_name !== 'Jobs') { ?>
<div class="row author-post">
<div class="small-12 medium-4 column">
<img src="<?php echo get_avatar(); ?>" alt="" />
</div>
<div class="small-12 medium-8 column">
<h5 class="author-post__title"><?php the_author() ?></h5>
<p>
Lorem Ipsum has been the industry's standard dummy text
ever since the 1500s, when an unknown printer took a
galley of type and scrambled it to make a type specimen
book. It has survived not only five centuries, but
also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s
with the release of Letraset sheets containing.
</p>
</div>
</div>
<?php } ?>
</div>
</section>
<?php endwhile;?>
I am trying to pull through the avatar of the author that has written the post. I thought that would make this work but it doesn't seem to output the right url and gives me a 404 on the image.
What methods have other people done to pull through the avatar image?
I'm looking for an answer that tells me how to do that and if there isn't an image to not show one.
UPDATE:
I have tried to make this work using the below code: I should mention that I am trying to make this work on my local machine as well.
echo get_avatar($authorId, 100);
(the variable uses get_the_author_id()
)
<?php echo get_avatar( $id_or_email, $size, $default, $alt, $args ); ?>
where id_or_email
is required. This is missing in your code. For more https://codex.wordpress.org/Function_Reference/get_avatar
So in your code, try to get author image:
<?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With