Useful trick: Forum avatar in post author bio
-
Themes such as Twenty Eleven have post templates where an “About the Author” box appears at the bottom of single-page posts, especially on multi-author sites.
Up until now, it has been difficult to get the Author Bio avatar to use the author’s phpBB forum avatar. A solution was presented mbazdell, although in reality sloppy coding and typos meant that it actually didn’t work.
I’ve managed to fix his code, and reposted here for anyone who is interested. As always, save your work regularly and backup your files in case things go south.
1) In wp-phpbb-bridge/inc/wpbb_functions.php, paste the contents of the following Pastebin directly after the function definition for get_forum_avatar:
2) In your child theme’s copy of content-single.php, replace:
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) ); ?>
with:
<?php echo get_forum_author_avatar(get_the_author_meta('user_email'), 68); ?>
From now on, the author bio will grab the corresponding user avatar from phpBB instead of the default Gravatar.
Hope you guys find this useful.
- The topic ‘Useful trick: Forum avatar in post author bio’ is closed to new replies.