If you’re using Tweet Import, there is an easy way to display the Twitter user avatar of imported tweets.

When importing tweets, Tweet Import creates a new post per tweet. In addition to this, Tweet Import also adds a ‘tweetimport_author_avatar’ Custom Field containing a link to the Twitter user image.

Custom Fields can be easily read in templates using the ‘get_post_meta’ WordPress function as follows:

get_post_meta($post->ID,'tweetimport_author_avatar' , true);

Since the ‘tweetimport_author_avatar’ Custom Field contains only the link to the Twitter user avatar or image, it should be wrapped properly with a HTML <img> Tag. Remember that if you are mixing imported tweets and regular posts in the same page, you need to check whether the post being rendered has a ‘tweetimport_author_avatar’ Custom Field or otherwise an annoying empty image will be renderd.

Since the above code should be inside the WordPress Loop, the final code should look something like this:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  ...
  <?php $meta_value = get_post_meta($post->ID,'tweetimport_author_avatar' , true);
  if (isset($meta_value) && $meta_value != '') : ?>
    <img src="<?php echo($meta_value); ?>" />
  <?php endif; ?>
  ...
<?php endwhile; else: ?>
  ...
<?php endif; ?>