I’m not familiar with the WP Biographia plugin, but these are the ways available to add a caption if you can modify the structure of the biography display.
You can add captions via the shortcode like this, if you want them to have the same layout as captioned images in your posts:
[avatar user="admin" size="medium" align="left" link="file"]Photo Credit: Your Name[/avatar]
In order to make this code dynamic, you’d have to put it directly in a template like this:
<?php echo do_shortcode('[avatar user="'.$user_id.'" size="medium" align="left" link="file"]'.$caption.'[/avatar]'); ?>
In order to get the caption that you’ve stored in your database, you would have to get the post_excerpt value of the attachment ID, which is stored in the usermeta table. You can get the value like this, if you pass the correct user ID which I’m assuming is the post author:
global $wpdb, $blog_id, $post;
$user_id = $post->post_author;
$wpua = get_user_meta($user_id, $wpdb->get_blog_prefix($blog_id).'user_avatar', true);
$caption = get_post_field('post_excerpt', $wpua);
Thread Starter
bahead
(@bahead)
Thanks for the quick response. I just realized that my issue is really with the WP Biographia plugin. I need to modify that plugin’s code to display the caption along with the avatar from your plugin. Your tips will help.
Thread Starter
bahead
(@bahead)
I was able to make the changes I needed to the WP Biographia plugin using the approach you suggested. Captions are now displaying with the avatars. Thanks again for your help!