<?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>WordWeb &#187; Kommentare</title>
	<atom:link href="http://www.wordweb.ch/tag/kommentare/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wordweb.ch</link>
	<description>Web- &#38; Werbetexte mit Wirkung</description>
	<lastBuildDate>Mon, 23 Jan 2012 20:26:53 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress-Tipp: die neusten Kommentare auflisten</title>
		<link>http://www.wordweb.ch/wordpress/wordpress-neuste-kommentare-auflisten/</link>
		<comments>http://www.wordweb.ch/wordpress/wordpress-neuste-kommentare-auflisten/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 16:24:49 +0000</pubDate>
		<dc:creator>Barbara Frolik</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Kommentare]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://www.wordweb.ch/?p=164</guid>
		<description><![CDATA[In deinem Blog die neusten Kommentare anzuzeigen, ist eine schöne Möglichkeit, dich bei deinen Besuchern fürs Mitmachen zu bedanken. In diesem Artikel erfährst du, wie du mit einem WordPress-Hack oder Plugin eine Liste der letzten Kommentare erstellen kannst.


WordPress-Hack
Wenn du keine Angst davor hast, direkt im Code deines Templates zu arbeiten, kopiere einfach die folgenden Zeilen [...]]]></description>
			<content:encoded><![CDATA[<p class="lead">In deinem Blog die neusten Kommentare anzuzeigen, ist eine schöne Möglichkeit, dich bei deinen Besuchern fürs Mitmachen zu bedanken. In diesem Artikel erfährst du, wie du mit einem WordPress-Hack oder Plugin eine Liste der letzten Kommentare erstellen kannst.</p>
<p class="post-img"><a href="http://www.wordweb.ch/wordpress/wordpress-neuste-kommentare-auflisten/"><img class="border" src="http://www.wordweb.ch/upload/blog/20100119-wordpress-kommentare/01-wordpress-kommentare" /></a></p>
<p><span id="more-164"></span></p>
<h3>WordPress-Hack</h3>
<p>Wenn du keine Angst davor hast, direkt im Code deines Templates zu arbeiten, kopiere einfach die folgenden Zeilen an die gewünschte Stelle.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,90) AS com_excerpt
FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;comments</span>
LEFT OUTER JOIN <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> ON (<span style="color: #006699; font-weight: bold;">$wpdb-&gt;comments</span>.comment_post_ID =
<span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span>.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = ''
ORDER BY comment_date_gmt DESC
LIMIT 4&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$comments</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pre_HTML</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;ul&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;li&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;strong&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author_url</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/a&gt;&quot;</span>
<span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; schreibt: &lt;/strong&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;span class=<span style="color: #000099; font-weight: bold;">\&quot;</span>latestcomments-text<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;em&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #339933;">.</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">com_excerpt</span><span style="color: #009900;">&#41;</span>
<span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; (...) &lt;/a&gt;&lt;/em&gt;&lt;/span&gt;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$post_HTML</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Gefunden bei <a href="http://www.wprecipes.com/how-to-list-most-recent-comments">Wprecipes</a> und von mir angepasst.</p>
<p>Deine Kommentarliste sieht dann genau so aus wie jene im Footer dieses Blogs. Der Code gibt die letzten vier Kommentare aus. Und zwar mit Namen und URL der Person, die den jeweiligen Kommentar geschrieben hat. Der Kommentar wird ausserdem auf 90 Zeichen gekürzt. Wenn man auf den Kommentar klickt, kommt man zum entsprechenden Artikel. Natürlich werden nur genehmigte Kommentare angezeigt.</p>
<h4>Den Code kannst du wie folgt anpassen:</h4>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">SUBSTRING<span style="color: #009900;">&#40;</span>comment_content<span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">90</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>Ersetze einfach die 90 durch eine andere Zahl, wenn du mehr oder weniger als 90 Zeichen ausgeben möchtest.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">LIMIT <span style="color: #cc66cc;">4</span><span style="color: #0000ff;">&quot;;</span></pre></td></tr></table></div>

<p>Ersetze die 4 beispielsweise mit einer 3, wenn du nur die drei neusten Kommentare auflisten möchtest.</p>
<p>Wenn du dich mit HTML auskennst und bei dem etwas komplizierten Code nicht den Überblick verlierst, kannst du natürlich auch den Rest nach Belieben anpassen. Weitere Erklärungen zum Thema Kommentare in WordPress-Templates findest du im <a href="http://codex.wordpress.org/Function_Reference/get_comment">WordPress-Codex</a>.</p>
<h3>WordPress-Plugin</h3>
<p>Wenn du lieber ein Plugin verwendest, empfehle ich dir <a href="http://wordpress.org/extend/plugins/get-recent-comments/">Get Recent Comments</a>.</p>
<p class="post-img"><a href="http://wordpress.org/extend/plugins/get-recent-comments/"><img class="border" src="http://www.wordweb.ch/upload/blog/20100119-wordpress-kommentare/02-wordpress-kommentare" /></a></p>
<p>Das Plugin ist sehr flexibel und verfügt über viele verschiedene Funktionen. So unterstützt es beispielsweise die Anzeige von Gravatars und das Sortieren der Kommentare nach diversen Kriterien. Du kannst das Plugin entweder als Widget in deine Sidebar einfügen oder den folgenden Code-Schnipsel an die gewünschte Stelle in dein Theme kopieren.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_recent_comments'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;li&gt;&lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Recent Comments:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
      &lt;ul&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> get_recent_comments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;/ul&gt;
&lt;/li&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>   
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_recent_trackbacks'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;li&gt;&lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Recent Trackbacks:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
      &lt;ul&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> get_recent_trackbacks<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;/ul&gt;
&lt;/li&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<h3>Jetzt bist du dran!</h3>
<p>Kennst du weitere hilfreiche Plugins und Hacks, mit denen man das Beste aus der Kommentarfunktion von WordPress-Blogs rausholen kann? Ich freue mich auf deinen Kommentar (und keine Sorge, ich werde nicht nur die Kurzversion im Footer lesen)! ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wordweb.ch/wordpress/wordpress-neuste-kommentare-auflisten/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

