<?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>Texto.de - Mein WordPress Magazin &#187; template</title>
	<atom:link href="http://www.texto.de/tag/template/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.texto.de</link>
	<description>Tutorials zu  WordPress als Blog, WordPress als CMS, WP SEO tauglich machen - einfach ein WP Nachschlagewerk</description>
	<lastBuildDate>Tue, 31 Jan 2012 22:41:38 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Statische Seite X zeigt Beitr&#228;ge von Kategorie Y an.</title>
		<link>http://www.texto.de/statische-seite-x-zeigt-beitraege-von-kategorie-y-an-170/</link>
		<comments>http://www.texto.de/statische-seite-x-zeigt-beitraege-von-kategorie-y-an-170/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 22:37:14 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[Tipps und Tricks]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[wordpress-cms]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=170</guid>
		<description><![CDATA[Update 2011: Neue Technik. Ich mag Beitr&#228;ge einer bestimmten Kategorie nur anzeigen, wenn man auf einer bestimmten statischen Seite ist. Dies kann man in WordPress leicht lösen.]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:260px;">
<dt>&nbsp;</dt>
<dd><img  src="http://www.texto.de/wp-images/loop-wordpress-mts.gif" alt="WordPress Loop in Action viele Beispiele" width="250" height="250" /></dd>
</dl>
<p><span class="caplize">A</span>ngefragt wurde ich, wie man es in WordPress schafft, dass man beim Aufrufen der statischen Seite X soundsoviele Beitr&auml;ge aus der Kategorie Y angezeigt bekommt.  </p>
<div class="eyecatch">Diese Anfrage kam im Februar 2006 und daher veröffentlichte ich am 1. März 2006 das erste Mal diesen Artikel. Heute habe ich ihn komplett neu geschrieben und trage damit den veränderten Möglichkeiten in WordPress Rechnung. </div>
<p>Als Vorbereitung für diese Lösung musst Du:</p>
<ol>
<li>Admincenter//Dashboard==>Seiten==>ID der Seite suchen und merken.
</li>
<li>Admincenter//Dashboard==>Artikel==>Kategorien==>ID der Kategorie suchen und merken.
</li>
</ol>
<p>In meinem Beispiel ist die ID der Seite 9.<br />
Die ID der Kategorie ist 3.<br />
Eingetragen habe ich es in meiner sidebar.php.</p>
<h3>ein benutzerdefinierter Loop &#8211; beeinflusst der auch andere </h3>
<p>Diese Lösung funktioniert vor dem normalen Loop und nach dem normalen Loop und wie immer habe ich eine sehr einfache Erklärung mit dabei. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   Und ich kanns nicht oft genug erwähnen. Dieser Loop beeinflusst andere Loops nicht! </p>
<p><span id="more-170"></span></p>
<p> Direkt in die page.php kann man dies schreiben.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
 <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'9'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// ID der gewünschten Seite ?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tmp_post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'numberposts'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'offset'</span><span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'category'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">6</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myposts</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$myposts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d.m.:'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot; title=&quot;  <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<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>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<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;/a&gt;.
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span>  <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp_post</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> 
&nbsp;
 &lt;/ul&gt;
&nbsp;
<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></div></div>

<p><strong>Erkl&auml;rung</strong>:</p>

<div class="wp_syntax"><div 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>is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'9'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// ID der gewünschten Seite ?&gt;</span></pre></div></div>

<p>Das heißt ausgesprochen:<br />
Wenn es die Seite mit der ID 9 ist, dann&#8230;</p>
<p>Das &lt;ul&gt; öffnet die ungeordnete Liste, in der ich die Beitr&auml;ge anzeigen lassen mag => logisch kannst Du das ändern.</p>

<div class="wp_syntax"><div 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;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tmp_post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'numberposts'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'offset'</span><span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'category'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">6</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myposts</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$myposts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Meine Erklärungen sind meist sehr bildhaft <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Liebes WordPress, du glaubst zwar jetzt gehts um eine Seite, doch ich gebe dir nun den Befehl zeige Artikel an,<br />
und zwar 6 (numberposts), aber nicht die ersten 3 (offset) und zwar nur aus der Kategorie mit der ID 6.</p>
<p>Und hole alles was zu einem Artikel dazugehört aus der Datenbank raus (setup_postdata). </p>
<p class="eingerueckt">===>  Du könntest also auch Autoren, benutzerdefinierte Felder etc anzeigen lassen. </p>
<p>Jetzt wird angegeben wie die Beitr&auml;ge aussehen sollen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
&lt;li&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d.m.:'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot; title=&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<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>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<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;/a&gt;.&lt;/li&gt;</pre></div></div>

<p>Hier hast Du freie Wahl. Ich lasse zuerst das Datum anzeigen, dann nur den Link zum Beitrag.<br />
Packe dann alles zwischen die &lt;li&gt; und &lt;/li&gt;, damit die Liste richtig wird.   </p>
<h3> alles bis zum &#8220;more-tag&#8221;&#8230;. </h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$more</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Weiterlesen'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h3>den Loop   beenden &#8211; so damit er andere Loops nicht stört</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span>  <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp_post</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Dies ist wichtig, damit WordPress wei&#223;, es muss nicht mehr weiterarbeiten. (endforeach) und dies beendet den Loop komplett, sodass weitere Loops nicht von diesem beeinflusst werden  ( $ post = $ tmp_post )</p>
<p>Abfrage, ob man auf der richtigen Seite ist mag auch beendet werden&#8230;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<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></div></div>

<p>Schlie&#223;t den ganzen Komplex, der mit if&#8230;. anfing.</p>
<p><strong>Artikelhistorie:</strong></p>
<p>Erstveröffentlichung: 01. März 2006 19:59<br />
Update: 3.11.2011</p>
<p>Viel Spa&#223; beim Ausprobieren. </p>
<div class="sign"> bei Fragen einfach fragen..</div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/statische-seite-x-zeigt-beitraege-von-kategorie-y-an-170/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/statische-seite-x-zeigt-beitraege-von-kategorie-y-an-170/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Templates machen das Leben einfacher &#8211;  vergiss query_posts</title>
		<link>http://www.texto.de/templates-machen-das-leben-einfacher-vergiss-query_posts-1302/</link>
		<comments>http://www.texto.de/templates-machen-das-leben-einfacher-vergiss-query_posts-1302/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 20:21:41 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[Tipps und Tricks]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1302</guid>
		<description><![CDATA[query_posts verändert die Ausgabe des Standard Loops. Individuelle Templates können sehr oft query_posts ersetzen. Hier einige Tipps dazu. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:260px;">
<dt>&nbsp;</dt>
<dd><img  src="http://www.texto.de/wp-images/loop-wordpress-mts.gif" alt="WordPress Loop in Action viele Beispiele" width="250" height="250" /></dd>
</dl>
<p><span class="caplize">H</span>ierarchie all überall auch in der WordPress Welt <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .<br />
Für den Redakteur soll die Profilseite schon anders aussehen, als für den Autor. query_posts author=6</p>
<p>Und meine Portfolio Kategorie hat sich ein ganz eigenes Aussehen einfach verdient! query_posts cat=345</p>
<p>In all meiner Auflistung der Musiker (mittels custom taxonomien) ist mir Britney einfach was schöneres wert&#8230;. usw.   query_posts   array    &#8216;musiker&#8217; => &#8216;britney&#8217; </p>
<p>Immer wenn es darum geht eine bestimmte Ausnahme in der Darstellung zu machen sehe ich dann Konstrukte mit Loops. <strong>query_posts</strong> ist da allgemein sehr beliebt.</p>
<p>Man sucht sich in den diversen loop.php Dateien kreuz und quer, sucht verzweifelt nach if-Schleifen, die aber doch if-Abfragen sind und kennt sich schlussendlich selbst nicht mehr aus. Haare werden Grau, Falten beginnen die Nasenwurzel zu zieren&#8230;</p>
<p>Und das alles nur wegen <b>query_posts</b>. Ich bin ja strikt dafür dies aus dem Codex zu entfernen. Ratzefatz weg damit, denn was macht dieser so offensichtlich einfache Loop.  </p>
<p><span id="more-1302"></span></p>
<h3>Was macht  query_posts</h3>
<p>zb</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">query_posts<span style="color: #009900;">&#40;</span> author<span style="color: #339933;">=</span><span style="color: #cc66cc;">5</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
get_header<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>
get_footer<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<blockquote><p>
query_posts ist die einfachste Art die Standard Ausgabe der Artikel pro URL zu ändern.<br />
zb Archiv, Kategorie, Tagseite, Startseite, Einzelansicht eines Artikels.</p>
<p><cite>Codex zu <a href="http://codex.wordpress.org/Function_Reference/query_posts" title="Codex">query_posts</a></cite></p></blockquote>
<p>Ja, es ist die einfachste Art, doch es zerstört nachhaltigst die natürliche   Ordnung in WordPress. </p>
<p class="eingerueckt">Nutzt Du <strong>query_posts</strong> veränderst Du die gesamte Standardausgabe der Artikel: Angefangen von den template tags bishin zu den globalen Variablen. </p>
<p>=> die meisten verzweifeln , weil dann die Pagination /Weiterblätterei nicht mehr funktioniert.<br />
=> die wenigsten erkennen, dass query_posts immer 2 queries macht. Stichwort: Performance Deines Blogs.</p>
<p><b>Tipp </b>==> Nutze <strong>query_posts</strong> nur, wenn   Dir wirklich absolut und überhaupt keine Alternative mehr einfällt.  Und das ist so selten der Fall.<br />
Und wenn Du es schon nutzt, dann setz den Loop wieder zurück mit wp_reset_query( ) . </p>
<h3>Wie kannst Du query_posts umgehen.</h3>
<p><span class="firstletter">1.</span><br />
Für die Redakteuren eine wunderbare Profilseite: <strong>author-{nickname}.php</strong> oder <strong>author-id.php</strong>.</p>
<p class="eingerueckt">Keiner hat 100derte von Redakteure in seiner WP Installation, diese paar Templates sind schneller erstellt, als stundenlanges suchen nach query_posts Lösungen. </p>
<p><span class="firstletter">2.</span><br />
Für die Portfolio Kategorie ein eigenes Aussehen: <strong>category-slugname.php</strong> oder <strong>category-id.php</strong>. </p>
<p><span class="firstletter">2a.</span><br />
Ist Dein Portfolio ein <strong>custom post type</strong>, dann  <strong>archive-{post_type}.php</strong>  =><strong> archive-portfolio.php</strong> und für die Einzelansichten <strong>single-{post_type}.php</strong> =><strong> single-portfolio.php</strong>.</p>
<p><span class="firstletter">3.</span><br />
Für Deine Britney aus der custom Taxonomie:<strong> taxonomy-{taxonomy}-{term}.php</strong></p>
<p>Ist die Taxonomie Musiker und der Slug der Taxonomie ist britney, dann findet WP auch <strong>taxonomy-musiker-britney.php</strong></p>
<p><b>Fazit:</b> Bevor Du krampfhaft versuchst alles in einem template unterzubringen nutze die <a href="http://www.texto.de/update-cheat-cheet-wp-template-hierarchie-909/" title="Template Hierarchy">Template Hierarchie</a> von WordPress voll aus und Du hast</p>
<p>1. mehr Überblick in deinem ThemeOrdner und<br />
2. weniger Chance je query_posts nutzen zu wollen. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<div class="sign"> ich hab es lieber einfacher, denn dreimal ums Eck gedacht..  <img src="http://www.texto.de/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /></div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/templates-machen-das-leben-einfacher-vergiss-query_posts-1302/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/templates-machen-das-leben-einfacher-vergiss-query_posts-1302/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Praxis: Sidebar für eine bestimmte Kategorie</title>
		<link>http://www.texto.de/praxis-sidebar-fuer-eine-bestimmte-kategorie-1264/</link>
		<comments>http://www.texto.de/praxis-sidebar-fuer-eine-bestimmte-kategorie-1264/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 23:21:21 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WP-CMS]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[WordPress Theme]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1264</guid>
		<description><![CDATA[Eine Sidebar mit ganz eigenen Widgets  für eine ganz bestimmte Kategorie. Wie geht man dabei in WordPress   vor, was sollte man beachten. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:260px;">
<dt>&nbsp;</dt>
<dd><img  src="http://www.texto.de/wp-images/wordpress-cms-komplexe-projekte.jpg" alt="WP  Praxis eine Sidebar für eine Kategorie" width="250" height="250" /></dd>
</dl>
<p><span class="caplize">W</span>ie geht man vor, um für eine bestimmte Kategorie eine anders gestaltete/aufgebaute (auch mit Widgets bestückte) Sidebar aufzurufen? &#8211; Dies wurde ich per E-mail gefragt.  Ich zeige hier in diesem Artikel einen Weg auf. Doch wie immer gilt, es gibt ganz viele Wege nach Rom <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Kommt drauf an was man schlussendlich wirklich alles braucht. </p>
<p>Wenn solche Arbeitsschritte erklärt werden liest sich dies meist langsamer als es dann gemacht wird. Und ich versuche immer sehr genau zu erklären, so dass Du dies wirklich 1:1 nachmachen kannst. </p>
<h3>Was man dazu braucht:</h3>
<ul>
<li>Einen Texteditor (WordPad ist keiner)
</li>
<li>die category.php oder archive.php des verwendeten Themes.
</li>
<li>den &#8220;Category Slug&#8221; der gewählten Kategorie.
</li>
<li>die sidebar.php.
</li>
<li>die functions.php um dort neue Widgets einzutragen und für ein paar neue Funktionen.
</li>
</ul>
<p><span id="more-1264"></span></p>
<h3>das neue Template category-slug.php erstellen</h3>
<p>Um die Übersicht in dem ThemeOrdner zu bewahren ist es günstig für solche Aktionen wirklich ein eigenes <strong>category-slug.php </strong>Template zu erstellen.</p>
<p>Einfach die category.php, wenn die nicht da ist im ThemeOrdner, dann die archive.php öffnen und als category-slug.php abspeichern.</p>
<p>Den &#8220;Slug&#8221; einer Kategorie findest Du entweder in der URL, oder <strong>Dashboard ==> Artikeln==>Kategorie==> Titelform</strong>.</p>
<p>WordPress erkennt solche Templates von sich aus, dies habe ich mal <a href="http://www.texto.de/update-cheat-cheet-wp-template-hierarchie-909/" title="Template Hierarchy">hier</a> beschrieben. </p>
<h3>das neue Template sidebar-categoryslug.php</h3>
<p>Ebenfalls der Übersicht wegen ist es günstig, die neue Sidebar unter dem &#8220;Slug&#8221; /Titelform dieser Kategorie abzuspeichern.</p>
<p>Also sidebar.php öffnen und als sidebar-categoryslug.php abspeichern.<br />
WordPress erkennt dieses Template (noch) nicht von selbst, aber es erleichtert ungemein den Durchblick <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>category-slug.php und sidebar-categoryslug.php bekanntmachen</h3>
<p>Naja mir fiel da jetzt wirklich keine andere Überschrift ein, aber die category-slug.php weiß noch nicht, dass sie die neue Sidebar sidebar-categoryslug.php  herzeigen sollte, also muss man es ihr sagen. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Ganz am Ende der category-slug.php steht sicher:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Steht dies nicht dort, dann ist dieses Theme sicher ein eigenes Framework und ich tät dann davon abraten dies zu tun, außer man kennt sich in PHP gut aus => oder man fragt die ThemeErsteller. </p>
<p>Aber findest Du dort get_sidebar dann kann man WP sagen, dass es da eine spezielle Sidebar gibt:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'categorslug'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nun sucht WP nach einem Template das sidebar-categoryslug heißt und nimmt es. </p>
<p>Ab jetzt kann man in dieser Sidebar anzeigen was auch immer man mag, es wird nur für diese Kategorie genommen. </p>
<h3>functions.php neue Widgets erstellen</h3>
<p>Meist stehen in der functions.php bereits Widgets, dort findet man dann auch wie das HTML für dieses Theme dort angeben ist. Ich nehm hier Beispiele aus TwentyTen Eleven.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">register_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'CategorySlugKATS'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'twentyeleven'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'sidebar-8'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'The sidebar for the special Category CategorySlug'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'twentyeleven'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;aside id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;&lt;/aside&gt;&quot;</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h3 class=&quot;widget-title&quot;&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Dies in die functions.php kopieren und dort sooft kopieren wie Du Widgets brauchst. name, id und description ändern, so dass es für Dich gut verständlich ist wofür dieses Widget da ist. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Sollte in der functions.php bereits ein Widget mit der ID 8 sein, dann logischerweise bitte eine andere nehmen. IDs kann es immer nur eine geben <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Widget1 oder Widget3 ist ganz nett, aber sagt Null, Nade Nix aus und spätestens nach 3 Monaten fragt man sich was das da soll.</p>
<h3>Widgets erstellt und nun in der sidebar-categoryslug.php abrufen.</h3>
<p>In der sidebar-categoryslug.php stehen vielleicht schon Widgets. Keine Ahnung, wenn dann löschen und durch das ersetzen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&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: #339933;">!</span> dynamic_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'sidebar-8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// end sidebar widget area  ID 8 ?&gt;</span></pre></div></div>

<p>sidebar-8 => die ID (!)</p>
<p>Hast du für diese Sidebar mehrere solche Widgets &#8220;Flächen&#8221; erstellt, dann eben sooft wiederholen wie nötig und die IDs anpassen. </p>
<p>Alle Templates   hochladen. Unter <strong>Dashboard=> Design=>Widgets </strong>diese befüllen und fertig biste.</p>
<h3>Haben nun auch alle Artikel dieser Kategorie diese Sidebar</h3>
<p>Nein.</p>
<p>Diese Sidebar wird aber nur in der Kategorie genommen. Sie erscheint noch nicht bei den Artikeln in dieser Kategorie.</p>
<p>Das aber wird ein nächster Artikel unter dem Stichwort: aus der Praxis&#8230;.., weil sonst wirds wirklich zulang. </p>
<div class="sign">Hast Du Fragen dazu einfach fragen bitte.   <img src="http://www.texto.de/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /></div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/praxis-sidebar-fuer-eine-bestimmte-kategorie-1264/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/praxis-sidebar-fuer-eine-bestimmte-kategorie-1264/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>3 Möglichkeiten für in_category außerhalb des Loops</title>
		<link>http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/</link>
		<comments>http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 07:20:24 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WP-CMS]]></category>
		<category><![CDATA[conditional-tags]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[wordpress-cms]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=421</guid>
		<description><![CDATA[Du magst, dass etwas ganz bestimmtes nur dann erscheint, wenn der Beitrag in einer bestimmten Kategorie ist. Dazu brauchst Du in_category.  Und zwei  neue Funktionen  in_category_extend und is_in_category, die die Verwaltung hochkomplexer Projekte erleichtern. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:260px;">
<dt>WP CMS komplexe Projekte</dt>
<dd><img  src="http://www.texto.de/wp-images/wordpress-cms-komplexe-projekte.jpg" alt="WP CMS einfache L&ouml;sungen f&uuml;r komplexe Projekte" width="250" height="250" /></dd>
</dl>
<p><span class="caplize"> I</span>ch wurde gefragt wie man <strong>in_category</strong> auch außerhalb des Loops nutzen kann. Meist braucht man dies in der Sidebar oder man mag ganz spezielle meta tags im html Header anzeigen. Oder man mag im Footer, also den sichtbaren Footer einer Website, was spezielles anzeigen. Oder man braucht dies für eine ganz spezielle Navigation. Oder&#8230; ?</p>
<p>Ich nutze  dafür drei Möglichkeiten:</p>
<ul>
<li><a href="http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/#query_post" title="Sprunglink zur Funktion query post">query post</a>.
</li>
<li>für komplexere Projekte <a href="http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/#in_category_extend" title="Sprunglink zur Funktion in_category_extend">in_category_extend</a> .
</li>
<li>und <a href="http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/#is_in_category" title="Sprunglink zur Funktion is_in_category">is_in_category</a>.
</li>
</ul>
<p><span id="more-421"></span></p>
<h3>in_category mit query post außerhalb des Loops nutzen<a id="query_post"></a></h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
 <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'29'</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;h3&gt;wenn ich category 20 zeige dies&lt;/h3&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Wir sind die Besten'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'kleine-funktionen'</span> <span style="color: #009900;">&#41;</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;h3&gt;Wenn in  Wir sind die Besten oder in der Cat kleine-funktionen liest du dieses&lt;/h3&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h3&gt;Sonst zeige jenes&lt;/h3&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></div></div>

<p>Dies hat den Vorteil es geht schnell und man muss sich nur die ID der Category, den Namen oder den Slug der Kategorien holen.<br />
Es hat den Nachteil, dass es relativ viel Code ist für so manches Projekt ist, weil diese Funktion beinhart ist: sie nimmt nur die angegebenen Kategorien, also &#8220;wirkt&#8221; nicht automatisch auch bei Unterkategorien. </p>
<h3>in_category bei komplexen Projekten mit WordPress</h3>
<p>zb Auf der Domain <a href="http://gesund.co.at/" title="Gesundheitsportal als Beispiel für ein komplexes Projekt">gesund.co.at</a> gibt es mehrere Hauptkategorien und jede Menge an Unterkategorien. Werbung soll in Abhängigkeit zur jeweiligen Hauptkategorie und ihrer Unterkategorien dargestellt werden und zwar auch in der Einzelansicht der jeweiligen Artikel.</p>
<p>Dies ist ein klassischer Fall für &#8220;<strong>in_category</strong>&#8220;. Aber sehr oft wird dies außerhalb jedweden Loops gebraucht und ich wollte mir die Übersicht in den Templates bewahren,und nicht bei jeder Nutzung von in_category elends Listen der Unterkategorien anführen müssen. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   </p>
<p>So suchte ich nach Lösungen und fand diese in der Funktion <strong>in_category_extend</strong> bei <a href="http://www.sycha.com/wordpress-function-in-category-extended" title="Charlie Evans in_category_extend">Charlie Evans</a>.</p>
<h3>in_category_extend<a id="in_category_extend"></a></h3>
<p>Diese Funktion kommt in die <strong>functions.php</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//credits to charlie evans</span>
<span style="color: #000000; font-weight: bold;">function</span> in_category_extended<span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// easy out</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> or is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// retrieve specified category (ID or slug)</span>
	<span style="color: #000088;">$obj_specified_category</span> <span style="color: #339933;">=</span> <span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> ? get_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> get_category_by_slug<span style="color: #009900;">&#40;</span><span style="color: #000088;">$category</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// we're viewing a category</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$current_category_ID</span> <span style="color: #339933;">=</span> get_query_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$current_category_ID</span> or cat_is_ancestor_of<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span><span style="color: #000088;">$current_category_ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// we're viewing a post</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$obj_post</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_queried_object</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>in_category<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj_post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> in_category<span style="color: #009900;">&#40;</span>get_term_children<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj_specified_category</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'category'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$obj_post</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: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Diese Funktion erweitert in_category derart, dass es auch die Unterkategorien miteinbezieht.</p>
<h3>in_category_extend im Template</h3>

<div class="wp_syntax"><div 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>in_category_extended<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fitness-beauty'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;Deine Angaben......&lt;/p&gt;'</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Damit war es aber bei dem Projekt gesund.co.at nicht getan. Manches sollte zwar in Abhängigkeit zu einer Hauptkategorie angezeigt werden, aber nicht in jeder Unterkategorie dieser Hauptkategorie. Da wirds mit query post und category_not_in auch irgendwann ziemlich kompliziert. Vor allem, weil dies innerhalb etlicher category.php und single.php zu tun wäre.</p>
<h3>is_in_category war dafür die Lösung.<a id="is_in_category"></a> </h3>
<p>Dies kommt in die <strong>functions.php</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> is_in_category<span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">func_num_args</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">func_get_args</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$category</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #009900;">&#123;</span>
                        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$category</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                        <span style="color: #009900;">&#123;</span>
                                <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Hier wird quasi in_category mit einer Variable bestückt. Sinnvoll ist es dieser Variable einen für die jeweilige Funktion sinnvollen Namen zu geben. Im array der Variable werden die IDs der Kategorien in aufsteigender Reihenfolge angeführt.</p>
<p>Somit kommen in die functions.php gleich unterhalb der Funktion is_in_category die Variablen mit den IDs.</p>
<p>Beispiel- die IDs sind Fantasieziffern <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$fitness</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">7</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">12345</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>is_in_category im Template </h3>

<div class="wp_syntax"><div 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>is_in_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$fitness'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;Deine Angaben......&lt;/p&gt;'</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Gibt es nun eine Änderung, also sollte auf einmal doch noch die Kategorie &#8220;ichbinneu&#8221; dazukommen und &#8220;ichbinalt&#8221; rausgenommen werden, muss man diese Änderung nur in der functions.php machen. </p>
<p>Dies bringt eine sehr große Zeitersparnis, guten Überblick und eine Reduktion der Fehler mit sich. Man könnt ja bei einer Änderung irgendwo einen Aufruf vergessen.  <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="sign">bei dem Projekt gesund.co.at brauchte ich deren viele => <img src="http://www.texto.de/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /> <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  </div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/in_category-ausserhalb-des-loops-nutzen-421/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Loop: Teaserartikel-andere Artikel ohne Teaser aber Weiterblättern</title>
		<link>http://www.texto.de/wp-loop-teaserartikel-andere-artikel-ohne-teaser-aber-weiterblaettern-1247/</link>
		<comments>http://www.texto.de/wp-loop-teaserartikel-andere-artikel-ohne-teaser-aber-weiterblaettern-1247/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 17:49:15 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WP-CMS]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[wordpress-cms]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1247</guid>
		<description><![CDATA[Loop in Aktion: Teaserartikel in WordPress erstellen, die folgenden Artikeln ohne Teaserartikel, aber Pagination also Weiterblättern soll weiterhin möglich sein. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:260px;">
<dt>WP Loop</dt>
<dd><img  src="http://www.texto.de/wp-images/loop-wordpress-mts.gif" alt="WordPress Loop in Action viele Beispiele" width="250" height="250" /></dd>
</dl>
<p>Michael von  <a href="http://www.simtimes.de/" title="Simtimes">SimTimes</a> fragte mich via Email: &#8220;Ich möchte den ersten Artikel meines Loops als Teaser-Artikel ausgeben. Aber das Weiterblättern funktioniert dann nicht mehr &#8211; hast Du eine Lösung?&#8221;.</p>
<p>Es gibt dafür jede Menge an Lösungen, ich zeige hier eine, wer weitere Lösungen weiß bitte in die Kommentare schreiben <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Auf Nachfrage erklärte mir Michael, dass sein Teaser Artikel einfach der zuletzt geschriebene Artikel ist. Gesucht hat er hier auf der Texto nach &#8220;first post&#8221;. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><span id="more-1247"></span></p>
<p>Ich bringe hier nur die Angaben für die Queries, aber nicht die Darstellung der Artikel. Da steht dann einfach im Code<br />
&lt;!-  -your stuff-  -&gt; Dies ist all das   was normalerweise nach &#8220;while have post the post&#8221; und vor &#8220;endwhile&#8221; steht.</p>
<h3>Loop für den Teaser Artikel</h3>
<p>Alles was jetzt kommt ersetzt  &#8220;if have post while have post the post&#8221;  => und das nachfolgende &#8220;endwhile else endif&#8221; =><br />
also es wird ein komplett neues Template erstellt (! ).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<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>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>    
<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span><span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'showposts=1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$do_not_duplicate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h1&gt;Deine Überschrift oder Du läßt dies hier einfach weg&lt;/h1&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><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>
&nbsp;
&lt;!--your stuff--&gt; 
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>showposts=1 => selbsterklärend, zeige 1 Artikel, magst Du mehrere, die Ziffer ändern.<br />
do not duplicate =>sagt WP, pass auf merk Dir diese ID, die darfst Du nämlich später nicht mehr zeigen <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Loop für die nachfolgenden Artikel ohne den 1. und mit Pagination</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>    
<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span><span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'showposts=10&amp;paged='</span><span style="color: #339933;">.</span><span style="color: #000088;">$paged</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h1&gt;Deine Überschrift oder Du läßt dies hier einfach weg&lt;/h1&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$do_not_duplicate</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span> update_post_caches<span style="color: #009900;">&#40;</span><span style="color: #000088;">$posts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!--your stuff--&gt; 
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!--code für das Weiterblättern next page previous page oder ein Plugincode--&gt;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   get_footer<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></pre></div></div>

<p> paged =paged=> jetzt wirds dann zum Weiterblättern<br />
if &#8230;.do not duplicate  continue update post cache=> wenn es diese ID von oben ist, dann geh einfach weiter, erneuere aber Deinen post cache WP und ab die Post <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="sign"> Ich habe diese beiden Loops nochmals getestet. Sie funktionieren einwandfrei. Wenns geholfen hat freu ich mich übers Weitersagen, ein +1 <img src="http://www.texto.de/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /></div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/wp-loop-teaserartikel-andere-artikel-ohne-teaser-aber-weiterblaettern-1247/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/wp-loop-teaserartikel-andere-artikel-ohne-teaser-aber-weiterblaettern-1247/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple:  Author Box -Autor Info unter jedem Artikel</title>
		<link>http://www.texto.de/author-box-autor-info-unter-jedem-artikel-1236/</link>
		<comments>http://www.texto.de/author-box-autor-info-unter-jedem-artikel-1236/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 16:01:12 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WordPress Theme]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[User-Verwaltung]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1236</guid>
		<description><![CDATA[Author Box unter jedem Artikel anzeigen. Hier zeige ich wie Du ganz einfach INFO über den Autor eines Artikels am Ende eines  Beitrags anzeigen kannst. Das Beispiel ist in html5 mit einfachstem Fallback und vielen CSS Klassen zur Gestaltung. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:360px;">
<dt> &nbsp;</dt>
<dd><img src="http://www.texto.de/wp-images/0911/autoren-bio-wordpress.gif" alt=" Autoren BIO unter jedem WP Artikel" width="350" height="75" /></dd>
</dl>
<p><span class="caplize">D</span>u magst unter jedem Artikel INFO zum Autor des Beitrages stehen haben => oder Du magst es erst nach dem Lesen des Artikels hier, weils so einfach ist <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Du brauchst dazu die functions.php  des verwendeten Themes. Wo Du dann diese Funktion einfügen kannst, hängt vom WP Theme ab, das Du verwendest. Ich bring hier die Lösung für TwentyTen.</p>
<p>Ein bisschen CSS und html Kenntnisse, damit Du diese Box, dann an Dein Theme anpassen kannst. </p>
<p>Wie immer bei solchen Beispielen erkläre ich alles sehr sehr genau, damit auch der absolute Anfänger sich zurecht findet. -naja ich hoff es ..</p>
<p><span id="more-1236"></span></p>
<h3>my Author Box in die functions.php</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">function my_author_box() { ?&gt;
&nbsp;
&lt;article class=&quot;author-profile vcard clearfix&quot;&gt;
  &lt;header class=&quot;author-profile-header&quot;&gt;
   <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'user_email'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'96'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
   &lt;h4 class=&quot;author-name fn n&quot;&gt;&amp;Uuml;ber: <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_posts_link<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;/h4&gt;
 &lt;/header&gt;
&nbsp;
&lt;p class=&quot;author-description author-bio&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'description'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/p&gt;&lt;p class=&quot;social&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'user_firstname'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'user_lastname'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> ist auch bei 
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span>  <span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'twitter'</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;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'twitter'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;Follow <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'display_name'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> on Twitter&quot;&gt;Twitter&lt;/a&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> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'gplus'</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;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'gplus'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;mein Profil bei G&amp;#43;&quot;&gt;G &amp;#43;&lt;/a&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> und 
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span>  <span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'xing'</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;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'xing'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;mein Profil bei XING&quot;&gt;Xing&lt;/a&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;
&lt;/p&gt;
&lt;/article&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>was macht diese Funktion my_author_box</h3>
<p>Einfach der Reihe nach aufgezählt:</p>
<p>get_avatar => holt den Avatar, 96 ist die frei wählbare Größe<br />
the_author_posts_link=> verlinkt auf die Autoren Seite, auf das Autoren Profil.<br />
the_author_meta => holt INFO aus der Profilseite im Adminbereich. In der Klammer steht dann genau welche geholt wird.</p>
<p>Hier im Beispiel zb:  description , user_firstname, user_lastname (wär halt schön, wenn das ausgefüllt wär <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> );<br />
twitter, display_name=Nickname, gplus und xing. </p>
<p><strong>hilfreiche Links</strong></p>
<p>Genaue Angaben findest Du im <a href="http://codex.wordpress.org/Function_Reference/the_author_meta" title="Author meta Referenz">Codex</a> und da Du ja auch selbst solche Profilfelder erstellen kannst, kannst Du auch diese damit abfragen.</p>
<p>Wie Du zusätzliche Felder auf der Profilseite erstellen kannst findest Du hier genau erklärt: <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#feld" title="Autoren und ihre Profilseite">Autoren und ihre Profilseite </a></p>
<h3>Wo soll nun die Autoren Box erscheinen</h3>
<p><strong>1. Möglichkeit: unter jedem Beitrag/Artikel </strong></p>
<p>öffne die <strong>loop.php</strong> von TwentyTen und suche dort nach:</p>

<div class="wp_syntax"><div 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> is_archive<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_search<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span></pre></div></div>

<p>In diesem kurzen Block findest Du auch:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;entry-content&quot;&gt; 
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span> <span style="color: #339933;">.....</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_link_pages<span style="color: #009900;">&#40;</span> <span style="color: #339933;">...</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;&lt;!--</span> <span style="color: #339933;">.</span>entry<span style="color: #339933;">-</span>content <span style="color: #339933;">--&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>und unterhalb von wp_link_pages schreibst Du nun hinein:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> my_author_box<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></pre></div></div>

<p>Speichern, hochladen inclusive der geänderten functions.php und sich daran erfreuen :-= </p>
<p><strong>2. Möglichkeit: bei statischen Seiten</strong></p>
<p>Dazu brauchst Du die <strong>loop-page.php </strong>von TwentyTen, doch die Funktion wird ebenfalls unterhalb wp_link_pages eingefügt und das findest Du auch in der loop-page.php ganz einfach.</p>
<h3> html5 </h3>
<p>In dieser Funktion findest Du html5 Angaben, wenn Dein Theme nicht in html5 ist, ersetze einfach &#8220;article&#8221; und &#8220;header&#8221; mit &#8220;div&#8221;. Also statt</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;article <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author-profile vcard clearfix&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;header <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author-profile-header&quot;</span>&gt;</span>
..
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>header&gt;</span>
..
..
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>article&gt;</span></pre></div></div>

<p>nimmst Du</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>  <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author-profile vcard clearfix&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author-profile-header&quot;</span>&gt;</span>
..
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
..
..
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h3>CSS Klassen für die Gestaltung der Autorenbox</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&nbsp;
<span style="color: #6666ff;">.author-profile</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.author-profile-header</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.author-name</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.author-description</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
oder/und
<span style="color: #6666ff;">.author-bio</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.social</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.avatar</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span>
oder/und
<span style="color: #6666ff;">.photo</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<div class="sign">
So nun wünsch ich viel Freud an der Autoren INFO Box unter jedem Beitrag oder auf Seiten in WordPress <img src="/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /> </div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/author-box-autor-info-unter-jedem-artikel-1236/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/author-box-autor-info-unter-jedem-artikel-1236/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>die vielen Möglichkeiten von the_excerpt &#8211; die Artikel Kurzfassung von WordPress</title>
		<link>http://www.texto.de/die-vielen-moeglichkeiten-von-the_excerpt-die-artikel-kurzfassung-von-wordpress-1218/</link>
		<comments>http://www.texto.de/die-vielen-moeglichkeiten-von-the_excerpt-die-artikel-kurzfassung-von-wordpress-1218/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 09:43:59 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[Tipps und Tricks]]></category>
		<category><![CDATA[statische Seiten]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[template-tag]]></category>
		<category><![CDATA[wordpress-plugins]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1218</guid>
		<description><![CDATA[the_excerpt in WordPress selbst schreiben. Erstelle Deine Kurzfassung eines WordPress Artikels und zeige dies mit the_excerpt dann an. Außerdem erkläre ich weitere Nutzungsmöglichkeiten. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:320px;">
<dt> Kurzfassungen verführen&nbsp;</dt>
<dd><img src="http://www.texto.de/wp-images/0811/mts-the-excerpt-individuell.gif" alt=" the_excerpt in WordPress selbst schreiben" width="302" height="220" /></dd>
</dl>
<p><span class="caplize">M</span>öchtest Du auf beim Klick auf die Kategorie oder vor jedem Artikel nur eine Kurzfassung des Artikels präsentieren, dann brauchst Du <strong>the_excerpt</strong>.  Selbstverständlich kann man diesen automatisch erstellen lassen, doch wesentlich besser ist es diesen selbst zu schreiben, weil Du damit eher Deine Leser ansprechen kannst.</p>
<p>Als erster erkläre ich wie man so eine Kurzfassung auch für statische Seiten in WP nutzbar machen kann,<br />
dananch wo man das Schreibfeld dafür findet, wie man ihn richtig schreibt, wo er überall erscheint, biete Code Beispiele und ganz am Schluss einige hilfreiche Links, solltest Du noch mehr aus the_excerpt herausholen wollen. </p>
<h3>the_excerpt für statische Seiten nutzbar machen</h3>
<p><span id="more-1218"></span></p>
<p>Es gibt einige Plugins, die Dir die Funktion des Auszugs (=Kurzfassung) in das Schreibpanel für statische Seiten holen.<br />
Doch dies geht ganz einfach in der <strong>functions.php</strong> des verwendeten Themes.</p>
<p>Öffne diese mit einem Texteditor und tippe dort wo Du es wiederfindest folgendes hinein:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//Auszug oder Kurzfassung fuer statische Seiten the excerpt</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_add_excerpts_to_pages'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_add_excerpts_to_pages<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     add_post_type_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'excerpt'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>the_excerpt selbst schreiben</h3>
<p>Schreibst Du einen Artikel dann kannst Du Dir unter dem Schreibfeld das Schreibfeld für die Kurzfassung anzeigen lassen. Wie das geht erklärte ich hier: <a href="http://www.texto.de/wordpress-menue-optionen-verstecktes-finden-1199/" title="Versteckte Optionen in WP finden.">versteckte Optionen in WP finden</a>. Sowohl bei Artikeln wie bei Seiten musst Du den Auszug spätestens ab WP 3.2.1 selbst aktivieren.</p>
<h3>the_excerpt die Kurzfassung richtig schreiben</h3>
<p>Schreibe maximal 1-2 kurze Sätze, die kurz und knackig den Inhalt des Artikels präsentieren. </p>
<p>Legst Du Wert darauf, dass man Deinen Blog bei den Suchergebnissen von Google anklickt, dann bedenke dies beim Schreiben <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Zu 90% nimmt Google nämlich diese meta description für die Snippets in den Suchergebnissen. </p>
<h3>the_excerpt als meta description nutzen &#8211; Google Snippet</h3>
<p>Viele der hilfreichen SEO Plugins nutzen the_excerpt, um damit die meta description im html-header zu erzeugen. Manche SEO bestehen darauf, dass diese meta description nur eine ganz bestimmte Zeichenlänge haben darf.</p>
<p>Dies ist zwar ein wenig Offtopic, doch ich sag immer:&#8221;achte darauf kurz und knackig zu sein und überleg Dir worauf Du klicken tätst.&#8221; Zeichenzählerei muss nicht wirklich sein. </p>
<p>Nutzt Du kein SEO Plugin- so wie ich &#8211; kannst Du dies selbst machen. </p>
<p>öffne die <strong>header.php</strong> mit einem Texteditor und schreibe dort bei all den anderen meta Angaben folgendes hinein:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">||</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;meta name=&quot;description&quot; content=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span>get_the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>strip_tags ist eine Vorsichtsmaßnahme, solltest Du doch einmal keine Kurzfassung schreiben und als erster ein Bild präsentieren magst Du sicher nicht, dass man &#8220;caption..&#8221; im Auszug findet. <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>Präsentier eine Inhaltsangabe zum Artikel  </h3>
<p>Hier auf der Texto.de siehst Du vor jedem Artikel eine kurze Inhaltsangabe.<br />
Auch dafür nutze ich the_excerpt. </p>
<p>WordPress Themes sind meist sehr eigen, daher ist es schwer hier eine sehr genaue Anleitung zu geben.</p>
<p>Für TwentyTen findest Du dies in der <strong>loop-single.php</strong>, hier am besten unterhalb dessen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;entry-meta&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> twentyten_posted_on<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;/div&gt;&lt;!-- .entry-meta --&gt;</pre></div></div>

<p>Das sieht dann so aus:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;entry-meta&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> twentyten_posted_on<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;/div&gt;&lt;!-- .entry-meta --&gt;
&lt;div class=&quot;entry-summary&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<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;/div&gt;</pre></div></div>

<p>In Twenty Eleven wäre dies die <strong>content-single.php</strong> und für statische Seiten die <strong>content-page.php</strong>.</p>

<div class="wp_syntax"><div 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: #0000ff;">'post'</span> <span style="color: #339933;">==</span> get_post_type<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;entry-meta&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> twentyeleven_posted_on<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;/div&gt;&lt;!-- .entry-meta --&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/header&gt;</pre></div></div>

<p>Entweder noch vor &#8220;endif /header oder gleich darunter.  Du kannst denselben Code nehmen wie für TwentyTen.</p>
<h3>Weitere the_excerpt INFOs und Spielereien findest Du hier:</h3>
<ul>
<li><a href="http://wpengineer.com/1684/wordpress-2-9-new-excerpt-filters/" title="neue Filter für the_excerpt">Neue the_excerpt Filter</a>.
</li>
<li><a href="http://wpengineer.com/1909/manage-multiple-excerpt-lengths/" title="Unterschiedliche Länge von Auszügen">Unterschiedliche Länge von Auszügen nutzen</a>.
</li>
<li>Kurzfassungen des Artikels in den <a href="http://www.wordpress-buch.de/2011/08/wordpress-kurzfassungen-in-suchergebnissen/" title="Kurzfassungen im Blog nutzen">Suchergebnissen Deines Blogs</a> nutzen.
</li>
</ul>
<div class="sign">war es hilfreich freu ich mich übers Weitersagen via Twitter oder G+ oder&#8230; <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/die-vielen-moeglichkeiten-von-the_excerpt-die-artikel-kurzfassung-von-wordpress-1218/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/die-vielen-moeglichkeiten-von-the_excerpt-die-artikel-kurzfassung-von-wordpress-1218/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Autoren und ihre Profilseite in WP</title>
		<link>http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/</link>
		<comments>http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 19:49:30 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WordPress Theme]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1216</guid>
		<description><![CDATA[Autoren Profile in WordPress  excellent darstellen. Ich erkläre hier wie man neue Felder in das WP Profil einfügt und diese dann in der author.php nutzt. Wie man die Anzahl der Autoren Artikel frei einstellt  und die Pagination funktioniert. Wie man die statischen Seiten anzeigt, die ein Autor schrieb. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:360px;">
<dt>Autoren Profil &#8220;texto&#8221;</dt>
<dd><img src="http://www.texto.de/wp-images/0811/autoren-profile-wordpress.gif" alt=" Autoren Profile in WP darstellen" width="350" height="207" /></dd>
</dl>
<p><span class="caplize">A</span>utoren sind wichtig, ohne Autoren kein Inhalt. Die Autorenseite in WordPress kann gut erweitert werden und zwar ohne Plugin. Bloß einige Felder in der functions.php angegeben und schon kann man unendlich viel INFO auf der Autoren Profilseite unterbringen. <br class="clear" /></p>
<h3>Ich zeige hier</h3>
<ol>
<li>wie man zusätzliche <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#feld" title="Sprunglink">Felder für das Profil</a> in WP einfügt.
</li>
<li>erkläre wie Du diese auch <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#felderklaerung" title="Sprunglink">ändern kannst</a>.
</li>
<li>erkläre wie man diese dann in der <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#authorphp" title="Sprunglink">author.php</a> darstellt.
</li>
<li>wie man nur Felder anzeigt, die auch <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#nichtleer" title="Sprunglink">ausgefüllt wurden</a>.
</li>
<li>zeige wie man die <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#artikelanzahl" title="Sprunglink">Anzahl der Artikel eines Autors</a> frei wählen kann und dennoch eine funktioniere &#8220;Weiterblätterei&#8221; also Pagination hat.
</li>
<li>zeige wie man auch die <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#seitenautor" title="Sprunglink">statischen Seiten</a>, die ein Autor erstellte anzeigen kann.
</li>
<li>und ich führe einige <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#cssautor" title="Sprunglink">CSSKlassen</a> meiner Beispiel author.php an.
</li>
<li> Und last but not least &#8211; ganz unten gibts was <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/#download" title="Sprunglink">kostenfrei</a> <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />
</li>
</ol>
<p>Aufgrund vieler Code Beispiele ist dieser Artikel lang, &#8211; doch es zahlt sich aus <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span id="more-1216"></span></p>
<h3>Zusätzliche Felder in der Profil Seite von WP<a id="feld"></a></h3>
<dl class="left" style="width:360px;">
<dt>Profilfelder</dt>
<dd><img src="http://www.texto.de/wp-images/0811/autoren-profile-felder.gif" alt=" Autoren Profile mit extra Felder " width="350" height="225" /></dd>
</dl>
<p> Um diese neuen Felder &#8211; weitere Internetadressen und einige SocialDienste anzuzeigen &#8211; brauchst Du die functions.php des verwendeten Themes und einen Texteditor. Wie immer der Hinweise WordPad ist keiner(!).</p>
<p>Dort wo Du es wiederfindest kopierst Du untenstehenden Code hinein.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">//spacial profil felder fuer autoren
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?&gt;
&lt;h3&gt;Special Profil Felder f&amp;uuml;r Dich&lt;/h3&gt;
&lt;table class=&quot;form-table&quot;&gt;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;website2&quot;&gt;2te Website &lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;website2&quot; id=&quot;website2&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'website2'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib die 2te Website URL an.&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;website3&quot;&gt;3te Website &lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;website3&quot; id=&quot;website3&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'website3'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib die 3te Website URL an.&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;twitter&quot;&gt;Twitter&lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;twitter&quot; id=&quot;website2&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'twitter'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib Deine Twitterprofil URL an.&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;gplus&quot;&gt;GPlus&lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;gplus&quot; id=&quot;gplus&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'gplus'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib Deine G+ URL an.&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&nbsp;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;xing&quot;&gt;Xing&lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;xing&quot; id=&quot;xing&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'xing'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib Deine Xingprofil URL an.&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'personal_options_update'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_save_extra_profile_fields'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'edit_user_profile_update'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_save_extra_profile_fields'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_save_extra_profile_fields<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'edit_user'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'website2'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'website2'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'website3'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'website3'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'twitter'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'twitter'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'gplus'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'gplus'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'xing'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xing'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Erklärung des Codes für diese Zusatzfelder<a id="felderklaerung"></a></h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;website2&quot;&gt;2te Website &lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;website2&quot; id=&quot;website2&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'website2'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib die 2te Website URL an.&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;</pre></div></div>

<p>Das da ergibt ein Feld &#8211; es ist sehr einfach änderbar, Du kopierst diesen Code, fügst ihn gleich vor dem nächsten &lt;tr&gt; ein und änderst alle &#8220;website2&#8243; in den Namen, den Du diesem Feld geben mags.<br />
Würde Dein neues Feld &#8220;Max Mustermann&#8221; heißen, dann ging das so&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
&lt;tr&gt;
&lt;th&gt;&lt;label for=&quot;maxmustermann&quot;&gt;max Mustermann&lt;/label&gt;&lt;/th&gt;
&lt;td&gt;
&lt;input type=&quot;text&quot; name=&quot;maxmustermann&quot; id=&quot;maxmustermann&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr
<span style="color: #009900;">&#40;</span> get_the_author_meta<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'maxmustermann'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;description&quot;&gt;Bitte gib die Info zu Max Mustermann an .&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;</pre></div></div>

<p>Einfach oder?</p>
<h3>Damit WordPress dieses neue Feld Max Mustermann erkennt und speichern kann</h3>
<p>Am Ende des langen CodeBeispiels findest Du</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'website2'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'website2'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nun für unsern MaxMustermann müßten wir so eine Zeile kopieren, gleich oberhalb einfügen und dann so abändern:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">update_usermeta<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'maxmustermann'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'maxmustermann'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Ich hoff bloß, dass nun keiner wirklich ein Max Mustermann Feld macht <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<h3>Wie nutze ich diese zusätzlichen Felder in der author.php<a id="authorphp"></a></h3>
<p>Zuerst musst Du der author.php überhaupt sagen, dass es da um einen ganz bestimmten Nutzer geht.</p>
<p>Du änderst den Aufruf des headers so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>  get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'author_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
        <span style="color: #000088;">$curauth</span> <span style="color: #339933;">=</span> get_user_by<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'slug'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$author_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span>
        <span style="color: #000088;">$curauth</span> <span style="color: #339933;">=</span> get_userdata<span style="color: #009900;">&#40;</span><span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Absolut simple diese Variable <strong>curauth</strong> gibt uns immer das was wir brauchen.</p>
<p>Einige Beispiele:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_url</span> <span style="color: #666666; font-style: italic;">//bringt die URL des User, die er bei &quot;Kontaktinfo Website&quot; angegeben hat.</span>
<span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span> <span style="color: #666666; font-style: italic;">//zeigt was er in das Feld &quot;Über Dich&quot; Beschreibung angab.</span>
<span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website2</span> <span style="color: #666666; font-style: italic;">//bringt die Website, die in das Feld Website2 kam ....</span>
<span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gplus</span> <span style="color: #666666; font-style: italic;">// die URL zum G+ Profil....</span></pre></div></div>

<h3>das Autoren Profil soll aber Felder nur anzeigen, die ausgefüllt wurden<a id="nichtleer"></a></h3>
<p>Nun dann fragt man eben pro Feld, ob es nicht leer ist&#8230;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<h3>So nun der Code der author.php bis zu den Artikeln</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
&lt;header class=&quot;page-header author&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span> get_the_author_id<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span> <span style="color: #cc66cc;">80</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;h2 class=&quot;page-title author&quot;&gt;
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_url</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">last_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
&lt;/h2&gt; &lt;span class=&quot;meta-author&quot;&gt;schrieb bisher <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> count_user_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</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: #000000; font-weight: bold;">?&gt;</span> Artikel&lt;/span&gt;
&lt;/header&gt;
&lt;article class=&quot;post hentry author clearfix&quot;&gt;
&lt;div class=&quot;entry-description&quot;&gt;
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;h3&gt;So beschreibt sich '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' selbst&lt;/h3&gt;'</span><span style="color: #339933;">;</span>  
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p class=&quot;description-author&quot;&gt;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_description</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;h4&gt;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' im Web&lt;/h4&gt;'</span><span style="color: #339933;">;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;&lt;span class=&quot;linktitel-author&quot;&gt;Website&lt;/span&gt;&lt;span class=&quot;link-author&quot;&gt;&lt;a class=&quot;website&quot; href=&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_url</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_url</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;&lt;span class=&quot;linktitel-author&quot;&gt;2.te Website &lt;/span&gt;&lt;span class=&quot;link-author&quot;&gt;&lt;a class=&quot;website2&quot; href=&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website2</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website2</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;&lt;span class=&quot;linktitel-author&quot;&gt;3.te Website &lt;/span&gt;&lt;span class=&quot;link-author&quot;&gt;&lt;a class=&quot;website3&quot; href=&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website3</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">website3</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gplus</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;&lt;span class=&quot;linktitel-author&quot;&gt;Einkreisen mit &lt;/span&gt;&lt;span class=&quot;link-author&quot;&gt;&lt;a class=&quot;gplus&quot; href=&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">gplus</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;&gt;G&amp;#43;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xing</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;&lt;span class=&quot;linktitel-author&quot;&gt;Kontakt bei  &lt;/span&gt;&lt;span class=&quot;link-author&quot;&gt;&lt;a class=&quot;xing&quot; href=&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">xing</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;&gt;XING&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
<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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">twitter</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
<span style="color: #b1b100;">echo</span><span style="color: #0000ff;">'&lt;p&gt;&lt;span class=&quot;linktitel-author&quot;&gt;Verfolge auf &lt;/span&gt;&lt;span class=&quot;link-author&quot;&gt;&lt;a class=&quot;twitter&quot; href=&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">twitter</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;&gt;Twitter&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;&lt;/article&gt;</pre></div></div>

<p>Du siehst hier ziemlich gut in dem Code was Du ändern kannst &#8211;  bist Du php Unerfahren,dann ändere eines lade das Template hoch und schau, ob ein Fehler kam.<br />
Wenn ja, dann geh wieder zum Original zurück und schau ganz genau zuerst den Code an.</p>
<h3>die Anzahl der Artikel eines Autors frei wählen<a id="artikelanzahl"></a></h3>
<p>Mir diesem Loop kannst Du die Anzahl der Artikel frei wählen, denn manchmal zeigt man pro Archiv oder Kategorie eine andere Anzahl an Artikel an, als man hier haben mag.</p>
<p>Und dieser Loop funktioniert mit der Weiterblätterei // Pagination einwandfrei!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span><span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'showposts'</span> <span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span>post<span style="color: #339933;">,</span> <span style="color: #0000ff;">'author'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'paged'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$paged</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><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>
&nbsp;
Das was Du anzeigen magst ....
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>  <span style="color: #000000; font-weight: bold;">?&gt;</span>
 <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Bei showposts kannst Du Deine Anzahl eintragen. &#8220;-1&#8243; zeigt alle Artikel an, die der Autor je geschrieben hat.</p>
<h3>Statische Seiten des Autors anzeigen mit oder ohne Navigation unterhalb<a id="seitenautor"></a></h3>
<p>Manchmal magst Du die statischen Seiten anzeigen, die ein Autor geschrieben hat.</p>
<p><strong>Achtung:</strong> zeigst Du nur statische Seiten an, kannst Du auch die Pagination nutzen.<br />
Aber Artikel und statische Seiten &#8220;paginiert&#8221; ergibt Chaos.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
&lt;h3&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span><span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'showposts'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span>page<span style="color: #339933;">,</span> <span style="color: #0000ff;">'author'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'paged'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$paged</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;header class=&quot;page-header&quot;&gt;
&lt;h3&gt;Seiten von  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$curauth</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/h3&gt;&lt;/header&gt;
   &lt;article <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'clearfix'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt; 
&lt;div class=&quot;entry-author&quot;&gt;
&lt;ol class=&quot;article-author&quot;&gt;
 <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><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;li&gt;
&lt;h3   class=&quot;entry-title&quot;&gt;
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title_attribute<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>&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<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;/a&gt;&lt;/h3&gt;
&lt;/li&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>  <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$temp</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;/ol&gt;&lt;/div&gt;&lt;/article&gt;&lt;/h3&gt;</pre></div></div>

<h3>die Navigation für die vorherigen und nächsten Artikel</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;nav id=&quot;nav-below&quot;&gt;
&lt;p&gt;&lt;span class=&quot;alignright&quot;&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span>  previous_posts_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'| Neuere Eintr&amp;auml;ge &amp;raquo;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/span&gt;&lt;span class=&quot;alignleft&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_posts_link<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&amp;laquo; vorherige Eintr&amp;auml;ge |'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/span&gt; &lt;/p&gt;&lt;/nav&gt;</pre></div></div>

<h3>CSS Klassen zum Designen der Autoren Seite<a id="cssautor"></a></h3>
<p><strong>Das Bild &#8211; der Avatar</strong><br />
folgende CSS Klassen stehen da zur Verfügung: .avatar .avatar-80 (abhängig von der Größe des Avatars)  .photo .avatar-default<br />
Da man meist die Klasse .avatar bereits bei den Kommentaren angesprochen hat, empfiehlt es sich hier auf die übergeordnete CSS Klasse zurückzugreifen. In dem Fall .page-header.</p>
<p>Das ganze sieht in der Style.css dann so aus.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.page-header</span> <span style="color: #6666ff;">.avatar</span><span style="color: #00AA00;">&#123;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>die <strong>Beschreibung</strong><br />
p.description-author{}</p>
<p><strong>die weiteren Profile im Web</strong><br />
span.linktitel-author{}<br />
span.link-author{}<br />
a.website{}<br />
a.gplus{}<br />
a.xing{}<br />
a.twitter{}<br />
Du könntest den Links (a) ja auch ein Hintergrundbild geben und dafür sind die CSS Klassen sehr gut geeignet.</p>
<div class="download" id="download">
Download:<a href="http://s5.histats.com/stats/r.php?473254&#038;100&#038;26400&#038;urlr=&#038;www.texto.de/wp-themes/2011/author-082011-mts.zip" title="Download des Beispiel Templates author.php">author.php</a>
</div>
<div class="sign">und die Autorin des Artikels freut sich übers Twittern, G+ en und weitersagen <img src="/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /> </div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/autoren-und-ihre-profilseite-in-wp-1216/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Artikel der letzten XYZ Tage</title>
		<link>http://www.texto.de/artikel-der-letzten-xyz-tage-1178/</link>
		<comments>http://www.texto.de/artikel-der-letzten-xyz-tage-1178/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 21:58:12 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WP-CMS]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[wordpress-plugins]]></category>

		<guid isPermaLink="false">http://www.texto.de/?p=1178</guid>
		<description><![CDATA[WordPress Artikel der letzten XY Tage anzeigen. Eine simple Archiv Funktion für WordPress mit dem WordPress Plugin Posts from Last X Days von DagonDesign. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:360px;">
<dt> Artikel der letzten XYTage</dt>
<dd><img src="http://www.texto.de/wp-images/2010/12/mts-7-tage-news.gif" alt=" Artikel der letzten Tage" width="350" height="146" /></dd>
</dl>
<p>  <span class="caplize">F</span>ür ein neues Projekt suchte ich nach einer einfachen Möglichkeit, Artikel der letzten 7 Tage anzuzeigen.  </p>
<p>Fündig wurde ich bei DagonDesign, dort wird ein älteres, aber voll funktionierendes WordPress Plugin angeboten, dass genau dies macht.   <a href="http://www.dagondesign.com/articles/posts-from-last-x-days-plugin-for-wordpress/" title="Posts from last x days Dagon Design"><strong>Posts from Last X Days</strong></a> heißt es und bietet eine einfache OptionsPage, auf der man das HTML und die Anzahl der Tage eintragen kann.  </p>
<p>Außerdem gibt es 2 simple Möglichkeiten der Nutzung. Entweder direkt in das Textfeld  eines Artikels oder <span id="more-1178"></span>einer Seite bei WP eintragen oder direkt in das template mittels PHP. </p>
<p>Ich stelle hier kurz beide Möglichkeiten vor. </p>
<h3>  Posts from Last X Days  von DagonDesign verwenden.</h3>
<ul>
<li>Plugin  <a href="http://www.dagondesign.com/articles/posts-from-last-x-days-plugin-for-wordpress/" title="Posts from last x days Dagon Design">Posts from Last X Days</a> herunterladen, entpacken, in den <strong>wp-content/plugins/</strong> Ordner hochladen.<br />
<br />Oder via Admininterface von WP direkt holen und aktivieren. </li>
<li>Nachher findet man unter: <strong>Admincenter==> Einstellungen==> DDLastCDays</strong> die OptionsPage des WP Plugins.</li>
</ul>
<p>Die OptionsPage des Plugins ist wirklich selbsterklärend. </p>
<p>Nur kurz zur deutschen Anzeige des Datums: da trug ich  <strong>d.m.Y</strong> ein. </p>
<h3>Posts from Last X Days direkt in ein Textfeld schreiben.</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- lastxdays X --&gt;</span></pre></div></div>

<p>Wobei das X für die Anzahl der Tage steht. </p>
<h3>Posts from Last X Days in einem Template nutzen.</h3>
<p>Erstellst Du ein eigenes Template für dies Anzeige der Artikel der letzten XY Tage, dann ist es sinnvoll folgendes zu nutzen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&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;">'lastxdays_generate'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>   
<span style="color: #b1b100;">echo</span> lastxdays_generate<span style="color: #009900;">&#40;</span>X<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Auch hier steht das X für die Anzahl der Tage. </p>
<p>Zuerst frage ich, ob die Funktion überhaupt da ist  [ if (function_exists('lastxdays_generate')] &#8211; dies verhindert Fehlermeldungen, wenn das Plugin mal abgeschaltet wird, dann sag ich PHP gib die Funktion zurück [echo lastxdays_generate(X)]. </p>
<h3>&#8230;und was ist mit WordPress 3.1</h3>
<p>Dieses WordPress Plugin <strong>Posts from Last X Days</strong> von Dagon Design funktioniert auch mit der Entwicklerversion von WordPress 3.1 ==>3.1-beta2.</p>
<div class="sign">Weitersagen! Danke! <img src="/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /></div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/artikel-der-letzten-xyz-tage-1178/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/artikel-der-letzten-xyz-tage-1178/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Das Geheimnis der WP Template Hierarchie &#8211;  Template Cheat Sheet zum Ausdrucken</title>
		<link>http://www.texto.de/das-geheimnis-der-wp-template-hierarchie-template-sheet-zum-ausdrucken-600/</link>
		<comments>http://www.texto.de/das-geheimnis-der-wp-template-hierarchie-template-sheet-zum-ausdrucken-600/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 17:27:08 +0000</pubDate>
		<dc:creator>texto</dc:creator>
				<category><![CDATA[WordPress Theme]]></category>
		<category><![CDATA[cheat-sheet]]></category>
		<category><![CDATA[conditional-tags]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[WP-30]]></category>

		<guid isPermaLink="false">http://www.texto.de/texto/das-geheimnis-der-wp-template-hierarchie-template-sheet-zum-ausdrucken/</guid>
		<description><![CDATA[Die WP Template Hierachie in einem Bild dargestellt und die WP Conditional Tags gleich mit dazu. Welches Template nutzt WP, wenn man sich eine Kategorie ansieht, welches bei einer Galerie. ]]></description>
			<content:encoded><![CDATA[<dl class="left" style="width:360px;">
<dt> WordPress Cheat Sheet</dt>
<dd><img src="http://www.texto.de/wp-images/0610/mts-wp30-template-hierarchie.gif" alt=" WP Template Hierarchy als Cheat Sheet zum Ausdrucken" width="350" height="400" /> </dd>
</dl>
<p>  <span class="caplize">W</span>elches Template nutzt WordPress wann &#8211; auf diese Frage gibt mein Template Cheat Sheet die Antwort.  Dieser Template Cheat Sheet hilft Theme Autoren genauso wie jedem, der einfach spezielle Sachen in seinen Templates realisieren mag.<br class="clear" /></p>
<div class="eyecatch">
<p>WP 3.0 bringt viele neuen Templates &#8211; und viele neue Conditional Comments &#8211; ich empfehle zu lesen &#8211; und dann das neue Cheat Sheet herunterzuladen.  ==> gleich danach drüber Twittern und weitersagen <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>WordPress Cheat Sheet Download:</p>
<p> Im Download ist das große Bild 3072 X 2304  und eine .pdf Datei enthalten. <br />&raquo;<a href="http://s5.histats.com/stats/r.php?473254&amp;100&amp;26639&amp;urlr=&amp;www.texto.de/wp-themes/2011/template-hierarchy.zip" title="Template Hierarchie als .zip Datei">Download Template Hierarchie </a>&laquo;</p>
</div>
<p>Die nützlichen<strong> Conditional Tags</strong> habe ich auch gleich dazugetippt. Conditonal Tags sind Bedingungsabfragen.</p>
<p> Einige außergewöhmliche Conditional Tags findet man dann hier im Artikel. Außerdem gebe ich -soweit gefunden- auch gleich Linktipps.</p>
<h3>WP Template Hierarchie</h3>
<p>WP erkennt bis auf  &#8220;yourname.php&#8221; all diese angeführten Templates, wenn sie im jeweiligen Theme Ordner vorhanden sind und wenn sie genau die angeführten Namen haben. </p>
<p><span id="more-600"></span></p>
<h3>Was muss ein WordPress Theme unbedingt haben</h3>
<ol>
<li>index.php
</li>
<li>style.css</li>
</ol>
<p>Alles andere ist *Zusatz* <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<h3>home.php</h3>
<p>Wer als Startseite nicht die klassische Blogansicht haben mag, sondern eventuell statischen Text, kann eine home.php erstellen.<br />
Gibt es diese nicht im Theme Ordner nimmt WP automatisch die index.php.</p>
<p><strong>Conditonal Tags</strong> fragen nach einer Bedingung. </p>
<p>z.B.: Wenn Startseite dann gib die class current_page_item zurück:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; class=<span style="color: #000099; font-weight: bold;">\&quot;</span>current_page_item<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Oder seit WP 2.5</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; class=<span style="color: #000099; font-weight: bold;">\&quot;</span>current_page_item<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Nutzt man eine <strong>statische Seite</strong> als Startseite ist man mit <strong>is_front_page</strong> besser dran. </p>
<p><strong>Linktipps:</strong></p>
<ul>
<li>Home Seite gestalten</li>
<li><a href="http://www.texto.de/texto/wordpress-cms-loop-spielereien/" title="Loopspielereien">Loop Spielereien</a></li>
</ul>
<h2>Einzelansichten, Posttypes, Darstellung eines Artikels</h2>
<h3>single.php</h3>
<p>Die single.php zeigt einen Artikel in der Einzelansicht an. Ist sie nicht vorhanden nimmt WP dafür die index.php.</p>
<p>Seit WP 3.0 kann man unterschiedliche Posttypes selbst erstellen. Dazu kommt noch ein Artikel, soweit sei erwähnt:</p>
<p><strong>single-posttype.php==>single.php==>index.php</strong></p>
<p><strong>Conditonal Tags</strong> für die Abfrage, ob es die Einzelansicht ist:</p>
<ul>
<li>is_single() einfach bei jeder Singleansicht.</li>
<li>is_single(&#8217;3&#8242;) nur beim Artikel mit der ID 3.</li>
<li>is_single(&#8216;Oh Nein&#8217;) nur für den Artikel mit dem Titel Oh Nein.</li>
<li>is_single(&#8216;ichbingut&#8217;) nur beim Artikel mit dem Postslug:ichbingut. <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </li>
<li>is_single(array(3,&#8217;ichbingut&#8217;,'Oh Nein&#8217;)) wenn es entweder die Single mit der ID 3 oder dem Titel Oh Nein oder dem Postslug ichbingut gibt.==> Achten auf die Schreibweise:case sensitiv!</li>
</ul>
<p><strong>Linktipp:</strong></p>
<ul>
<li><a href="http://www.texto.de/texto/spielerei-mit-dem-more-tag-von-wordpress/" title="More tag Spielereien">Spielereien mit dem more-tag</a></li>
</ul>
<h3>is_singular()</h3>
<p>Der conditaional Tag is_singular fragt alle Einzelansichten ab: vom Bild, Video, (pseudo)statische Seite, Einzelansicht des Artikels, die Kommentare etc.  </p>
<div class="eyecatch">Achtung: is_singular und is_single sind 2 verschiedene Sachen!<br />
Is_singluar fragt jede Einzelansicht ab, das kann statische Seite, Bildanhang, Video.php  etc sein. Is_single fragt nur die Einzelansicht eines Artikels ab!</div>
<h4>attachment.php</h4>
<p>Die single.php kann aber auch ganz automatisch die<strong> image.php </strong> für die Anzeige von  Bildern nutzen. Gibt es die image.php nicht, nimmt WP die <strong>attachment.php</strong>, gibt es diese auch nicht, nimmt WP die single.php. Außerdem gibt es die video.php, audio.php und  application.php- jedes Mal gilt ist eine von diesen nicht da, kommt die attachment.php danach die single.php.</p>
<p><strong>video.php, text.php.image.php (also jeder MimeType) ==> attachment.php==>single.php==>index.php</strong></p>
<p>AB <strong>WP 2.9 </strong>kann man für jeden MIME Type ein eigenes Template erstellen. text.php, video.php etc etc&#8230;</p>
<p><strong>Conditional Tag</strong></p>
<ul>
<li>
is_attachment ()
</li>
</ul>
<h2>Kommentare</h2>
<h4>comments.php comments-popup.php</h4>
<p>Mag man Kommentare nutzen braucht man entweder die<strong> comments.php </strong>oder die <strong>comments-popup.php</strong>.</p>
<p>Die comments-popup.php zeigt Kommentare als Popup an, doch dazu braucht es auch einen Eintrag in die header.php -also in den html header und zwar zwischen head und /head.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_script<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></pre></div></div>

<p>In der single.php oder index.php muss man dann diese Popups so aufrufen.<br />
Dieser Code ist gleich für ein lokalisiertes Theme. &#8220;mtsretro50&#8243; mit dem eigenen Namen ersetzen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_link<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No Comments'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'mtsretro50'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'1 Comment'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'mtsretro50'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'% Comments'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'mtsretro50'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Comments off'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'mtsretro50'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h2>virtuelle statische Seiten mit WordPress </h2>
<h3>yourname.php  page-slug.php page-id.php page.php</h3>
<p>ab WP 2.9:</p>
<p><strong>yourname.php, page-slug.php page-ID.php page.php </strong></p>
<p>WP kennt (virtuelle) statische Seiten, diese sind aus der Chronologie der anderen Artikel ausgenommen. Außerdem wird bei statischen Seiten kein Update Service  benachrichtigt.Also kein Ping an Technorati etc gesendet. (dafür gibt es allerdings ein Plugin!)</p>
<p>Dafür nimmt WP die <strong>page.php</strong> oder eben  die index.php. </p>
<p><strong>yourname.php==>page-slug.php ==>page-ID.php ==>page.php ==>index.php</strong></p>
<p><strong>yourname.php </strong> </p>
<p>Mag man selber eine statische Seite gestalten, dann muss man dieser einen Namen geben und im<br />
<strong>Admincenter==>Schreiben==>Seite</strong> nach unten scrollen und dort das Template dann auswählen.</p>
<p>Sinnvoll ist es das template so zu benennen wie die statische Seite dann heißt, dies hilft einfach dem Überblick, daher auch yourname.php.</p>
<p>Folgendes muss man ganz oben in der yourname.php hineintippen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name:Dein Name
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>ab WP 2.9: page-slug.php und page-ID.php</p>
<p>diese braucht man nur in den Theme Ordner zu legen und WP 2.9 erkennt sie automatisch. </p>
<p><strong>Conditional Tags:</strong></p>
<ul>
<li>is_page() jede statische Seite</li>
<li>is_page(&#8217;4&#8242;) nur die mit der ID 4</li>
<li>is_page(&#8216;email&#8217;) nur die mit dem Postslug Email.</li>
</ul>
<h4>is_page_template</h4>
<p>Seit WP 2.5. gibt es den neuen Conditional Tag <strong>is_page_template</strong>, dazu muss man den Dateinamen des Templates einfügen:</p>
<p>Wenn ein bestimmtes page template im Einsatz ist, dann mache&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">is_page_template<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'about.php'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<h4>Unterseiten</h4>
<p>Für Unterseiten gibt es keinen Conditional Tag, aber man kann sich so abhelfen:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Get $post if you're inside a function</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// This is a subpage</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// This is not a subpage</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>zB um unterschiedliche Header Bilder anzuzeigen, aber diese auch für die Unterseiten nutzen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">if</span> 	<span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span>about<span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$bannerimg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;home.jpg&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span>urlaub<span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;56&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
	<span style="color: #000088;">$bannerimg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tmeer.jpg&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span>reise<span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;15&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$bannerimg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;flugzeug.jpg&quot;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> 
	<span style="color: #000088;">$bannerimg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;home.jpg&quot;</span> <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Fall-through  </span>
<span style="color: #009900;">&#125;</span>	
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Linktipps:</strong></p>
<ul>
<li><a href="http://www.texto.de/texto/statische-seite-x-zeigt-beitraege-von-kategorie-y-an/" title="Statische Seite zeigt Artikel aus Kategorie Y an">Statische Seite zeigt Artikel aus einer bestimmten Kategorie an</a></li>
<li>Und weil dies sooft gefragt wird: <a href="http://www.texto.de/weiterblaettern-auf-der-statischen-seite-oder-sidebar-621/" title="Weiterblättern bei einem Custom Query"><strong>Weiterblättern</strong></a>.</li>
<li><a href="http://www.texto.de/texto/wp-als-cms-mehrere-statische-seiten-auf-einer-anderen-statischen-seite-anzeigen-lassen/" title="Statische Seitenauf einer einzigen statischen Seite anzeigen lassen.">mehrere statische Seiten auf einer statischen Seite anzeigen lassen</a></li>
<li><a href="http://www.texto.de/texto/sitemap-inhaltsuebersicht-statische-seite/" title="Eigene Sitemap erstellen">eigene Sitemap erstellen</a></li>
</ul>
<h2>Alles was mit *archivieren* zu tun hat Zeitarchive, Kategorien, Tags, Taxonomien </h2>
<h3>category-slug.php category-ID.php   category.php </h3>
<p><strong>ab WP 2.9</strong> :<strong>category-slug.php</strong> kommt dazu.</p>
<p>Dies wird eine große Erleichterung, denn man hat mehr Überblick im Theme Ordner <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Die Kategorieansicht zeigt WP mit der <strong>category.php</strong>, gibt es diese nicht nimmt es die <strong>archive.php</strong>, ist die auch nicht da, dann eben die index.php.</p>
<p><strong>category-slug.php==>category-id.php==>category.php==>archive.php==>index.php</strong></p>
<p>Mag man nur die category mit der ID 7 anders aussehen lassen als andere categorien, kann man dies mit dem template <strong>category-7.php</strong> realisieren.</p>
<p><strong>Conditional Tags:</strong></p>
<ul>
<li>is_category() jede Kategorie /Rubrik</li>
<li>is_category(&#8217;7&#8242;) nur die mit der ID 4</li>
<li>is_category(&#8216;tipps-und-tricks&#8217;) nur die mit dem Postslug tipps-und-tricks.</li>
<li>is_category(&#8216;Lesen&#8217;) nur die mit dem Titel Lesen.</li>
<li>is_category(array(7,&#8217;tipps-und-tricks&#8217;,'Lesen&#8217;)) entweder bei der Kategorie mit der ID 7 oder dem Postslug tipps-und-tricks oder dem Titel Lesen.</li>
</ul>
<h3>Unterschied zwischen IS_ oder IN_category</h3>
<p>Is_category wird gerne mit in_category verwechselt. Das erste fragt: ist es die Kategorie das 2. fragt ob etwas IN einer Kategorie ist und funktioniert nur innerhalb des Loops.</p>
<p><strong>Linktipps:</strong></p>
<ul>
<li>Bei jeder Kategorie soll ein Text dabei stehen.</li>
<li><a href="http://www.texto.de/texto/category-magic-wordpress-plugin-zufaellige-artikel-aus-einer-kategorie-auslesen/" title="Artikel aus einer Kategorie in der Sidebar anzeigen">Plugin Magic Kategorie</a></li>
</ul>
<h3>date.php</h3>
<p>Vielleicht mag wer auch nur ein Jahresarchiv anders gestalten oder einen speziellen Monat, dafür gibt es die <strong>date.php</strong>. Ist die nicht vorhanden nimmt WP die <strong>archive.php</strong> oder dann die index.php.</p>
<p><strong>date.php==>archive.php==>index.php</strong></p>
<p><strong>Conditional Tags:</strong></p>
<ul>
<li> is_date() für alle Datumsbezogenen Archive wie Monat, Jahr, Tag etc.</li>
<li>is_year() Nur für das Jahreaarchiv-</li>
<li>is_month() Wenn ein Monatsarchiv gezeigt wird.</li>
<li>is_day() Wenn es ein Tagesarchiv sein soll.</li>
<li>is_time() Wenn es die Stunde, Minute, Sekunde ist.</li>
</ul>
<h3>tag-slug.php tag-id.php tag.php</h3>
<p>ab <strong>WP 2.9 </strong>erkennt WP auch <strong>tag-ID.php</strong>.</p>
<p>Tags &#8211; die Schlagwörter oder Stichworte haben auch ihr eigenes template, wenn man mag. Ja sogar jedes Schlagwort kann sein eigenes template haben.</p>
<p>zB.: Tag heißt &#8220;hoffnung&#8221;, dann erstellt man die tag-hoffnung.php. Ist keine tag-slug.php da sucht WP die tag.php, ist die nicht da nimmt WP die archive.php, fehlt auch die einfach die index.php.</p>
<p><strong>tag-slug.php==>tag-id.php==>tag.php==>archive.php==>index.php</strong></p>
<p><strong>Conditional Tags:</strong></p>
<ul>
<li> is_tag() wenn einfach ein Schlagwort angezeigt wird.</li>
<li>is_tag(&#8216;hoffnung&#8217;) Nur dann , wenn das Schlagwort Hoffnung auftaucht.</li>
<li> is_tag(array(&#8216;hoffnung&#8217;,'mild&#8217;,'wetter&#8217;)) Wenn entweder das Schlagwort hoffnung oder mild oder wetter vorhanden ist. ==> auf die Groß-Kleinschreibung achten!</li>
</ul>
<h3>taxonomy-taxonomy-term.php, taxonomy-taxonomy.php taxonomy.php</h3>
<p>Du kannst Artikel nun mittels Kategorien, Tags und Taxonomien ordnen.<br />
Die Taxonomien fallen somit unter dem Hauptbegriff des &#8220;Archives&#8221;. </p>
<p><strong>taxonomy-taxonomy-term.php==> taxonomy-taxonomy.php==> taxonomy.php==>archive.php==>index.php</strong></p>
<p>Taxonomien werden nicht alle Blogger brauchen, aber die die viel zu sortieren haben, die reiben sich jetzt sicher vor Freud die Hände über WP 3.0 <img src='http://www.texto.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>conditional Tags:</p>
<ul>
<li> is_tax()  wenn eine Taxonomy Archivseite auftaucht.
 </li>
<li></li>
<li>is_tax(&#8216;buecher&#8217;) nur die Taxonomie Archive mit der URL *buecher* ==>case sensitive(!)
</li>
<li>is_tax(array(&#8216;buecher&#8217;,'autor&#8217;,'krimi&#8217;)) nur für die Txonomie Archivseiten mit der URL:entweder buecher oder autor oder krimi
</li>
</ul>
<p><strong>is_taxonomy()</strong>  fragt ab, ob eine bestimmte Taxonomie bei WP registriert wurde. </p>
<h3>author-nicename.php author-id.php author.php</h3>
<p>Mag man seinen Autoren eine eigene Seite gönnen, dann nutzt man die <strong>author.php</strong> ist die nicht vorhanden nimmt WP die <strong>archive.php</strong>,fehlt auch die dann die index.php.</p>
<p><strong>author-nicename.php==>author-id.php==>author.php==>archive.php==>index.php</strong></p>
<p><strong>Conditional Tags:</strong></p>
<ul>
<li>is_author() jeder Autor</li>
<li>is_author(&#8217;9&#8242;) nur der Autor mit der  ID 9</li>
<li>is_author(&#8216;eva&#8217;) nur die Autorin Eva</li>
<li>is_author(&#8216;pet&#8217;) nur der Autor Pet</li>
<li>is_author(array(9,&#8217;pet&#8217;,'eve&#8217;)) entweder wenn es der Autor mit der ID 9 ist  oder Pet oder Eve</li>
</ul>
<h3>Admin</h3>
<p>Den Admin fragt man am leichtesten mit </p>
<p><strong>is_admin()</strong> ab <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<h2>Such- und Error 404 (not found) Anzeige</h2>
<h3>search.php</h3>
<p>Es gibt einen eigenen <a href="http://www.texto.de/wp-27-neue-suche-get_search_form-656/" title="Suchform ">Template Tag für die Suche</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">get_search_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Mag man jedoch das Suchformular selbst gestalten kann man dies nach wie vor in der searchform.php.</p>
<p>In der <strong>search.php</strong> werden die Suchergebnisse angezeigt, ist diese nicht vorhanden nimmt WP dafür die index.php.</p>
<p>Wer seine Startseite wirklich komplett anders gestaltet hat ist gut daran eine eigene search.php zu erstellen.<br />
Man dazu ganz einfach die archive.php oder category.php öffnen und als search.php speichern. Das ist die simpelste Möglichkeit. </p>
<p><strong>search.php==>index.php</strong></p>
<p><strong>Conditional Tag:</strong></p>
<ul>
<li>is_search()</li>
</ul>
<p>Rein theoretisch kann man auch hier is_search(&#8216;search-term&#8217;) angeben, nur wer weiß so ganz genau wonach die User suchen <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>search-term ist das Suchwort.</p>
<h3>404.php</h3>
<p>Dies ist die Fehlerseite, die auftaucht, wenn es eine URL, ein Bild, einen Anhang etc. nicht mehr gibt. Auch als Error 404 bekannt. Es ist ratsam seine eigene 404.php zu erstellen, so verärgert man User nicht, wenn etwas nicht mehr gefunden wird.</p>
<p>Ist die nicht vorhanden nimmt WP die index.php dafür. </p>
<p><strong>404.php==> index.php </strong></p>
<p><strong>Conditional Tag:</strong></p>
<ul>
<li>is_404()</li>
</ul>
<p><strong>Linktipp:</strong></p>
<ul>
<li><a href="http://www.webdesign-in.de/mts/stoeckchendie-eigene-error-404-verhindert-dass-google-dir-deine-besucher-wegnimmt/" title="Eigene error 404">Eigene error 404</a></li>
<li><a href="http://www.gabis-bloghaeuschen.de/2008/02/14/stoeckchen-404/" title="Gabis Bloghäuschen">weitere error 404</a></li>
</ul>
<h2>Ab da wirds WordPress Theme machen einfach lustvoll und spannend:</h2>
<h3>functions.php</h3>
<p>Die <strong> functions.php</strong> erkennt WP, darin kann man nicht nur Angaben zu Widgets machen, sondern auch eventuell zu einer OptionsPage für das WP Theme oder anderen nötigen Code unterbringen.</p>
<h3>loop.php</h3>
<p>Die scheint zwar in der Template Hierarchie nicht auf, aber Twenty Ten ist da ein tolles Anschauungsgebiet und ich werde mich da sicher näher drauf einlassen.</p>
<p>Alle loops in ein template packen. </p>
<h3>Andere Conditional Tags </h3>
<h4>is_paged</h4>
<p>is_paged  fragt ab, ob etwas &#8220;geblättert&#8221; wird. Also ob es Seite 1 oder Seite 3 gibt. is_paged hilft nicht, wenn man einen Artikel oder eine statische Seite mit &#038;gt&#8211; nextpage&#8211;&lt; umgebrochen hat. Dafür gibt es keine Abfrage, dies mußte ich schmerzlichst selber erfahren <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h4>is_feed()</h4>
<p>Fragt ab, ob ein Feed vorhanden ist. Dies nutzen nur Plugin Autoren, der Enduser braucht dies kaum, genauso wie </p>
<h4>is_trackback()</h4>
<p>Fragt ab, ob ein Trackback vorhanden ist.</p>
<h4>is_sticky</h4>
<p>Fragt ab, ob der Artikel festegepinnt also *sticky* ist-man kann auch mit der ID des Artikels genau den bestimmten Artikel abfragen. </p>
<h3>Fazit </h3>
<p>Ohne <strong>index.php</strong> geht nichts <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Das minimalistischste WP Theme hat eine index.php und eine style.css, eventuell noch den Ordner &#8220;images&#8221; für Bilder des Layouts. </p>
<p>Kommentare als Popups findet man kaum noch wo. Am ehesten bei Fotoblogs. </p>
<h3>weiterführende Links</h3>
<ul>
<li><a href="http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page" title="Codex">Codex Conditonal Tags</a></li>
</ul>
<h3>Download des Template Sheets über die WP Template Hierarchie</h3>
<div class="eyecatch" style="font-weight:bold;"> Im Download ist das große Bild 3072 X 2304  und eine .pdf Datei enthalten.<br />
<br /><a href="http://s5.histats.com/stats/r.php?473254&amp;100&amp;26639&amp;urlr=&amp;www.texto.de/wp-themes/2011/template-hierarchy.zip" title="Template Hierarchie als .zip Datei">Download Template Hierarchie </a>.<br />
<br />Herunterladen, entpacken, ausdrucken. Auf A4 gut lesbar, ich habe es ausprobiert <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  .</div>
<p>Ich drucke mir solche Sheets immer auf Kartonpapier aus und laminier dieses dann. Manch einer mag es vielleicht in einer Folie griffbereit haben. </p>
<div class="eyecatch">
<p>war dies hilfreich für Dich, dann..</p>
<p>dann blogge darüber<br />
twitter es weiter<br />
meld es bei Deinem Social Network </p>
<p><img src="/wp-images/smilies/icon_confused.gif" alt="Kaffeetrinkender Smilie" width="27" height="21" /> Danke!</p>
</div>
<h3>Artikelhistorie:</h3>
<p>Erstveröffentlichung: 08.06.2008<br />
Update am 22.09. 2009 &#8211; neue Templates gibt es und einige neue Conditonal Comments.<br />
Update am 29.11.2009  &#8211; die neuen Templates für WP 2.9 hinzugefügt, Darstellung entschlackt und Download als .pdf hinzugefügt,<br />
neuen Counter installiert bis dato  4421 downloads im Jahr 2009. Im Jahr 2008 habe ich nicht gezählt.</p>
<p><strong>Update am 28.06.2010:</strong><br />
vom Nov.09-Juni 10- 1102 Downloads, [insgesamt 5523 Downloads seit  Sept. 09] Counter wird zurückgestellt.<br />
Neues .pdf., neues Bild, Erweiterung der conditional comments und der Erklärungen der neuen Templates.</p>
<div class="sign"> <img src='http://www.texto.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   </div>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. Original article:  <a href="http://www.texto.de/das-geheimnis-der-wp-template-hierarchie-template-sheet-zum-ausdrucken-600/" >texto.de</a> (Digital Fingerprint:  textoakamts[texto.de])</small><hr />]]></content:encoded>
			<wfw:commentRss>http://www.texto.de/das-geheimnis-der-wp-template-hierarchie-template-sheet-zum-ausdrucken-600/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>

