Show image if author meta (profile fields) exists outside loop
I am trying to show the profile fields (like AIM, Jibber) outside the loop. I managed to do that with
<?php
global $post;
$author_id=$post->post_author;
?>
<?php
$field='aim';
the_author_meta( $field, $author_id );
?>
But now, I can't put an image beside it if such a field exists. This works inside the loop, but not outside:
<?php if (get_the_author_meta('aim')) {
echo "
<div class=schrijver-socialmedia>
<img src=http://blablabla.com/images/aim_icon.png />
"; } ?>
How do I get this image outside the loop and only if the field exists?
I am trying to show the profile fields (like AIM, Jibber) outside the loop. I managed to do that with
<?php
global $post;
$author_id=$post->post_author;
?>
<?php
$field='aim';
the_author_meta( $field, $author_id );
?>
But now, I can't put an image beside it if such a field exists. This works inside the loop, but not outside:
<?php if (get_the_author_meta('aim')) {
echo "
<div class=schrijver-socialmedia>
<img src=http://blablabla.com/images/aim_icon.png />
"; } ?>
How do I get this image outside the loop and only if the field exists?
No comments:
Post a Comment