Latest Post

How to Get Profile image in wordpress

How to Get Profile image in wordpress

How to Get Profile image in wordpress


This code for get your profile image in wordpress, this code is working, try this code.

<?php
$user_id=get_the_author_id(get_the_ID());
$meta=get_user_meta($user_id);
$user=get_userdata($user_id);
#print_r($user);
$image_attributes = wp_get_attachment_image_src( $attachment_id = $meta['et_avatar'][0] );
if ( $image_attributes ) {?>
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>" />
<?php }else{?>
<img src="http://ture.bollywoodbite.in/wp-content/uploads/2016/08/default_avatar.png">
<?php

} ?>

No comments