Title: Gravatar/Avatar
Last modified: August 31, 2016

---

# Gravatar/Avatar

 *  Resolved [Nate](https://wordpress.org/support/users/kapitol/)
 * (@kapitol)
 * [10 years ago](https://wordpress.org/support/topic/gravataravatar/)
 * Hi Vee,
 * Your theme has been very easy for me to modify thus far. I do have one issue.
   I am trying to add a call to grab an author’s avatar/gravatar image to the ‘bootstrapBasicPostOn’
   section.
 * Each attempt I make to solve this myself ends up with nothing showing up. This
   is my modified code.
 *     ```
       if (!function_exists('bootstrapBasicPostOn')) {
       	/**
       	 * display post date/time and author
       	 *
       	 * @return string
       	 */
       	function bootstrapBasicPostOn()
       	{
       //		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
               $time_string = '';
       		if (get_the_time('U') !== get_the_modified_time('U')) {
       			$time_string .= '';
       //			$time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
       		}
   
       		$time_string = sprintf($time_string,
       			esc_attr(get_the_date('c')),
       			esc_html(get_the_date()),
       			esc_attr(get_the_modified_date('c')),
       			esc_html(get_the_modified_date()),
                   esc_attr(get_the_author_meta( 'ID' ), 32 )
       		);
   
       //		printf(__('<span class="posted-on">Written by %1$s</span><span class="byline"> Written by %2$s</span>', 'bootstrap-basic'),
       		printf(__('<span class="byline"> Written by %2$s</span>', 'bootstrap-basic'),
       			sprintf('<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
       				esc_url(get_permalink()),
       				esc_attr(get_the_time()),
       				$time_string
       			),
       			sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
       				esc_url(get_author_posts_url(get_the_author_meta('ID'))),
       				esc_attr(sprintf(__('View all posts by %s', 'bootstrap-basic'), get_the_author())),
       				esc_html(get_the_author())
       			)
       		);
       	}// bootstrapBasicPostOn
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Theme Author [vee](https://wordpress.org/support/users/okvee/)
 * (@okvee)
 * [10 years ago](https://wordpress.org/support/topic/gravataravatar/#post-7352458)
 * You should use `get_avatar()` function to get author’s avatar/gravatar.
    [https://codex.wordpress.org/Function_Reference/get_avatar](https://codex.wordpress.org/Function_Reference/get_avatar)
   [More references](https://codex.wordpress.org/Function_Reference) for use.
 *     ```
       if (!function_exists('bootstrapBasicPostOn')) {
       	/**
       	 * display post date/time and author
       	 *
       	 * @return string
       	 */
       	function bootstrapBasicPostOn()
       	{
       //		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
               $time_string = '';
   
       //		printf(__('<span class="posted-on">Written by %1$s</span><span class="byline"> Written by %2$s</span>', 'bootstrap-basic'),
       		printf(__('<span class="byline"> Written by %1$s</span>', 'bootstrap-basic'),
       			sprintf('<span class="author vcard"><a href="%1$s" title="%2$s">%3$s</a></span> %4$s',
       				esc_url(get_author_posts_url(get_the_author_meta('ID'))),
       				esc_attr(sprintf(__('View all posts by %s', 'bootstrap-basic'), get_the_author())),
       				esc_html(get_the_author()),
       				get_avatar(get_the_author_meta( 'ID' ))
       			)
       		);
       	}// bootstrapBasicPostOn
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Gravatar/Avatar’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/bootstrap-basic/1.3.9/screenshot.
   png)
 * Bootstrap Basic
 * [Support Threads](https://wordpress.org/support/theme/bootstrap-basic/)
 * [Active Topics](https://wordpress.org/support/theme/bootstrap-basic/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/bootstrap-basic/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/bootstrap-basic/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [vee](https://wordpress.org/support/users/okvee/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/gravataravatar/#post-7352458)
 * Status: resolved