<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Engineer &#187; Comment</title>
	<atom:link href="http://wpengineer.com/tag/comment/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Mon, 21 May 2012 22:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gravatars Use Easy</title>
		<link>http://wpengineer.com/507/gravatars-use-easy/</link>
		<comments>http://wpengineer.com/507/gravatars-use-easy/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 18:09:46 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Avatar]]></category>
		<category><![CDATA[Comment]]></category>
		<category><![CDATA[Gravatar]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Themes]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=507</guid>
		<description><![CDATA[Since version 2.5 of WordPress, Gravatar service is included in the core files. On one hand, you can use it to make the comment overview more nicely. But you can also integrate this function in your template and you don't have to use a Plugin. You just have to insert the following syntax and the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/ad516503a11cd5ca435acc9bb6523536.jpeg" alt="" title="ad516503a11cd5ca435acc9bb6523536" width="80" height="80" class="alignright size-full wp-image-504" /><br />
Since version 2.5 of WordPress, <a href="http://en.gravatar.com/">Gravatar service</a> is included in the core files. On one hand, you can use it to make the comment overview more nicely. But you can also integrate this function in your template and you don't have to use a Plugin.<br />
<span id="more-507"></span><br />
You just have to insert the following syntax and the little pictures will be displayed in your comment area of your theme.</p>
<pre lang="php">
&lt;?php if(function_exists(&#039;get_avatar&#039;)) {
	echo get_avatar( $comment );
} ?&gt;
</pre>
<p>The function <code>get_avatar()</code> (<code>/wp-includes/pluggable.php</code>) has 3 parameters, so you can adjust it easily to your liking.</p>
<ul>
<li><code>$id_or_email</code> Mail address or ID of the users, commentators</li>
<li><code>$size</code> Size of the Gravatars in pixel</li>
<li><code>$default</code> Default image, if the user doesn't have a Gravatar yet</li>
</ul>
<pre lang="php">
get_avatar( $id_or_email, $size = &#039;96&#039;, $default = &#039;&#039; )
</pre>
<p>As default Gravatar it loads http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536 , this is the icon for the email address unknown@gravatar.com (MD5 verschlüsselt: d516503a11cd5ca435acc9bb6523536). The default size is 96 Pixel. You just have to assign the first parameter or variable.</p>
<p>The output would look like this:</p>
<pre lang="php">
&lt;img alt=&#039;&#039; src=&#039;http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96&#039; class=&#039;avatar avatar-96 avatar-default&#039; height=&#039;96&#039; width=&#039;96&#039; /&gt;
</pre>
<p>Thus you can adjust the design with the help of CSS. The class <code>avatar</code> is available. Also you can use the class for the size of the Gravatar: <code>avatar-size</code>. Varied formattings are possible.</p>
<h3>How to implement?</h3>
<p>Since many people asking how to implement it, here is a short instruction for non-PHPler.</p>
<p>The code has to be in <code>comments.php</code>, it displays the comments and comment form. Of course it can be different, but in most themes it will be like that.</p>
<p>The function has to be in every output of each comment, that means it has to be within the loop <code>&lt;?php foreach ($comments as $comment) : &gt;</code> .<br />
Normally after the <code>li</code>, which displays every comment.</p>
<h4>Search:</h4>
<pre lang="php">
  &lt;ol class=&quot;commentlist&quot;&gt;

    &lt;?php foreach ($comments as $comment) : ?&gt;

       &lt;li &lt;?php echo $oddcomment; ?&gt;id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot;&gt;
</pre>
<h4>Replace:</h4>
<pre lang="php">
  &lt;ol class=&quot;commentlist&quot;&gt;

    &lt;?php foreach ($comments as $comment) : ?&gt;

      &lt;li &lt;?php echo $oddcomment; ?&gt;id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot;&gt;
        &lt;?php echo get_avatar( $comment, 32 ); ?&gt;
</pre>
<p>Some themes aren't using a list (<code>ol</code> or <code>ul</code>); the output gets create by <code>div</code>. The important thing is, it has to be in the loop.</p>
<pre lang="php">
&lt;?php foreach ($comments as $comment) : ?&gt;
. . .
&lt;?php endforeach; /* end for each comment */ ?&gt;
</pre>
<h4>Format via CSS</h4>
<p>The format could look like that. This syntax goes to the <code>style.css</code> of your used theme.</p>
<pre lang="css">
.commentlist li .avatar {
	float: right;
	border: 1px solid #eee;
	padding: 2px;
	background: #fff;
	}
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/507/gravatars-use-easy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

