<?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>kopflos &#187; WordPress Tags</title>
	<atom:link href="http://www.kopflos.eu/tag/wordpress-tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kopflos.eu</link>
	<description>gedanken über alles und nichts</description>
	<lastBuildDate>Tue, 15 Jun 2010 21:33:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>WordPress Seiten oder Beitr&#228;ge individuell formatieren</title>
		<link>http://www.kopflos.eu/wordpress-seiten-oder-beitraege-individuell-formatieren/</link>
		<comments>http://www.kopflos.eu/wordpress-seiten-oder-beitraege-individuell-formatieren/#comments</comments>
		<pubDate>Sat, 23 May 2009 16:08:43 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tags]]></category>

		<guid isPermaLink="false">http://www.kopflos.eu/?p=1280</guid>
		<description><![CDATA[Nun hat mich wieder einmal eine Anfrage ereilt, wie ich die unterschiedliche Einf&#228;rbung der Kategorien realisiert habe und wie es m&#246;glich ist, die Links der Schubladen beim &#252;berfahren in unterschiedlichen Farben darzustellen. Auf letzten Punkt &#8211; das Einf&#228;rben der Kategorien-Links will ich als erstes eingehen. Dies ist auch gleichzeitig das einfachste an der ganzen Sache. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="bordered" src="http://www.kopflos.eu/wp-content/uploads/2009/05/colors.png" alt="Farben" title="Farben" width="450" height="256" class="alignnone size-full wp-image-1316" /><br />
Nun hat mich wieder einmal eine Anfrage ereilt, wie ich die unterschiedliche Einf&auml;rbung der Kategorien realisiert habe und wie es m&ouml;glich ist, die Links der Schubladen beim &uuml;berfahren in unterschiedlichen Farben darzustellen.</p>
<p>Auf letzten Punkt &#8211; das Einf&auml;rben der Kategorien-Links will ich als erstes eingehen. Dies ist auch gleichzeitig das einfachste an der ganzen Sache. Denn WordPress versorgt von Hause aus &uuml;ber die Funktion <a href="http://codex.wordpress.org/Template_Tags/wp_list_categories"><em>wp_list_categories()</em></a> die Links f&uuml;r jede Kategorie mit entsprechenden &lt;li&gt;-Tags. Jedem Kategorie-Link wird die entsprechende ID im &lt;li&gt;-Tag mitgegeben; z.B.</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;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cat-item cat-item-9&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/category/kopflos/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>Kopflos<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span></pre></div></div>

<p><span id="more-1280"></span><br />
Somit kann in der entsprechenden CSS-Datei (meist die Standard CSS-Datei <em>style.css</em>) dieser Tag mit einer eigenen Formatierung versehen werden</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.cat-item-9</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#3366cc</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Darstellung Kategorien</h3>
<p>Damit nun die einzelnen Seiten der Kategorien-&Uuml;bersichten und auch die Beitr&auml;ge entsprechend ihrer Kategorienzugeh&ouml;rigkeit eingef&auml;rbt werden, ben&ouml;tigt man eine eigene CSS-Datei f&uuml;r die besondere Formatierung. In meinem Falle habe ich eine CSS-Datei <em>style_blue.css</em> erstellt, in der f&uuml;r alle Elemente die individuell formatiert werden sollen die Klassen vorhanden sind.</p>
<p>Um nun diese CSS-Datei zu laden, wird in der <em>header.php</em> abgefragt, welcher Kategorie der aktuelle Beitrag zugeordnet ist. Dazu nutze ich das WordPress Conditional-Tag <a href="http://codex.wordpress.org/Template_Tags/in_category">in_category()</a>, welches pr&uuml;ft, ob der Beitrag zu entsprechender Kategorie geh&ouml;rt.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style.css&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">11</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style_orange.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">14</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style_green.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">9</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style_blue.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style_red.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style_pink.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> in_category<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">13</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style_yellow.css&quot; /&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>Wenn alle CSS-Dateien f&uuml;r die einzelnen Kategorien erstellt sind, war&#8217;s das auch schon. Auf der Startseite, auf ja Beitr&auml;ge unterschiedlichster Kategorien auftauchen, ist der erste Beitrag welcher von WordPress gelesen wird ausschlaggebend f&uuml;r die Farbgebung.  Da es bei nicht dazu kommt, dass ein Beitrag mehreren Kategorien zugeordnet wird, kommt es auch hier nicht zu &Uuml;berschneidungen.</p>
<h3>Und wie kann ich das auf Seiten anwenden?</h3>
<p>Zuerst k&uuml;mmern wir uns hier auch um die Formatierung der Links f&uuml;r die Seiten.</p>
<p>In der Regel werden die Links bzw. das Men&uuml; f&uuml;r Seiten &uuml;ber die WordPress Funktion <a href="http://codex.wordpress.org/Template_Tags/wp_list_pages"><em>wp_list_pages()</em></a> erstellt. F&uuml;r die unterschiedliche Formatierung der Links (ob nun generell oder f&uuml;r das hover-Event) kann auch hier auf unterschiedliche Klassen in dem &lt;li&gt;-Tag, welcher durch <em>wp_list_pages()</em> generiert wird zur&uuml;ckgegriffen werden.</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;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_item page-item-389&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/stuff/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Downloads&quot;</span>&gt;</span>Downloads<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_item page-item-98&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/dr-brown-service/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Dr. Brown Service&quot;</span>&gt;</span>Dr. Brown Service<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_item page-item-113&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/impressum/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Impressum&quot;</span>&gt;</span>Impressum<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_item page-item-591&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/tools_d/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Tools&quot;</span>&gt;</span>Tools<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_item page-item-788&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/tutorials/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Tutorials&quot;</span>&gt;</span>Tutorials<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page_item page-item-573&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.kopflos.eu/wallpaper-of-the-month/&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Wallpaper of the Month&quot;</span>&gt;</span>Wallpaper of the Month<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span></pre></div></div>

<p>Hier wird also mit <em>page-item-nummer</em> jeder Link individuell ausgezeichnet und kann entsprechend formatiert werden.</p>
<p>Wem dies ein wenig zu kryptisch ist, der sollte sich einmal das Plugin <a href="http://wordpress.org/extend/plugins/classy-wp-list-pages/"><em>Classy wp_list_pages</em></a> anschauen. Damit ist es unter anderem m&ouml;glich &quot;sprechende&quot; Klassen oder aber auch IDs f&uuml;r die &lt;li&gt;-Tags zu generieren. Das Plugin bietet dar&uuml;ber hinaus auch noch weitere Vorteile beim klassifizieren der Tags.</p>
<p>Nun zu der Formatierung der einzelnen Seiten.</p>
<p>Mit der Abfrage der ID f&uuml;r die Kategorie kommt man f&uuml;r statische Seiten nicht weiter. Also muss man die einzelnen Seiten abfragen. Dazu nutzt man am besten das WordPress Conditional Tag <a href="http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page"><em>is_page()</em></a> zu einer Abfrage in der <em>header.php</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style.css&quot; /&gt;
<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: #cc66cc;">389</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/another.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'impressum'</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/onemore.css&quot; /&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>Wie zu sehen, kann &uuml;ber <em>is_page(&#8216;nummer&#8217;)</em> die Seite &uuml;ber die ID der Seite oder mit <em>is_page(&#8216;name&#8217;)</em> &uuml;ber den Namen der Seite abgefragt werden. Nun kann auch hier pro Seite ein zus&auml;tzliches individuelles Stylesheet geladen werden.</p>
<h3>Doch was, wenn viele Subpages oder Sub-Subpages vorhanden sind</h3>
<p>Oder im Laufe der Zeit mehrere davon hinzukommen oder wegfallen. Dann m&uuml;sste f&uuml;r jede Seite eine eigene Abfrage in der <em>header.php</em> eingebaut werden. Keine gute L&ouml;sung. Aber es gibt eine L&ouml;sung f&uuml;r dieses Problem: Das Plugin <a href="http://erik.range-it.de/wordpress/plugins/is_child/"><em>is_child</em></a>.</p>
<p>Dieses Plugin besteht eigentlich nur aus zwei Funktionen, die f&uuml;r den versierten WordPress Nutzer auch einfach in die <em>functions.php</em> des Themes kopiert werden k&ouml;nnen. Mit diesen Funktionen l&auml;sst sich feststellen, ob eine Seite in irgendeiner Ebene zu einer bestimmten anderen Seite im Verh&auml;ltnis steht &#8211; also sehr hilfreich f&uuml;r Sub-Subpages, da WordPress dies von Hause aus nicht kann.</p>
<p>Der Aufruf <em>is_child(389)</em> ergibt true, wenn die entsprechende Seite eine Unterseite (gleich welcher Ebene) der Seite mit der ID 389 ist. Aber auch mit <em>is_child()</em> ist es m&ouml;glich mit &quot;sprechenden&quot; Seitennamen zu arbeiten, z.B. <em>is_child(&#8216;about&#8217;)</em>.</p>
<p>So ist es also m&ouml;glich &uuml;ber die Abfrage in der header.php einem kompletten Men&uuml;-Ast eine individuelle Formatierung zuzuweisen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/style.css&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_child<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">389</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/another.css&quot; /&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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'about'</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;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$templatePath</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/onemore.css&quot; /&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>Nat&uuml;rlich k&ouml;nnen solche Abfragen auch an anderer Stelle vorkommen und individuelle Dateien, wie z.B. Sidebars laden. Gerade mit der Funktion <em>is_child()</em> ist hier einiges m&ouml;glich.</p>
<p>Ich hoffe der Beitrag ist f&uuml;r den einen oder anderen hilfreich. Bei Fragen oder weiteren Ideen hinterlasst bitte einen Kommentar.</p>
<small style="text-color:#cccccc;">Copyright &copy; 2010 by <strong><a href="http://www.kopflos.eu">kopflos</a></strong>  | This feed is for personal non-commercial use only. If you are reading this feed outside your news reader, the site you are looking on violates the copyright.</small><hr/><img src="http://www.kopflos.eu/?ak_action=api_record_view&id=1280&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.kopflos.eu/wordpress-seiten-oder-beitraege-individuell-formatieren/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Kompletter Beitrag nach &lt;more&gt;-tag</title>
		<link>http://www.kopflos.eu/kompletter-beitrag-nach-more-tag/</link>
		<comments>http://www.kopflos.eu/kompletter-beitrag-nach-more-tag/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 20:23:21 +0000</pubDate>
		<dc:creator>thomas</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tags]]></category>

		<guid isPermaLink="false">http://www.kopflos.eu/?p=1052</guid>
		<description><![CDATA[Auch hier wird hin und wieder der &#60;more&#62;-tag in WordPress-Beitr&#228;gen verwendet, damit ein langer Inhalt nicht die Seite sprengt. Vielleicht st&#246;rt es den einen oder anderen auch, dass nach dem Klick auf &#60;weiterlesen&#62;, der Beitrag genau ab dem Punkt angezeigt wird, an dem der &#60;more&#62;-tag steht. Wer dies in seinen Beitr&#228;gen verhindern m&#246;chte, editiert die [...]]]></description>
			<content:encoded><![CDATA[<p>Auch hier wird hin und wieder der &lt;more&gt;-tag in WordPress-Beitr&auml;gen verwendet, damit ein langer Inhalt nicht die Seite sprengt. Vielleicht st&ouml;rt es den einen oder anderen auch, dass nach dem Klick auf &lt;weiterlesen&gt;, der Beitrag genau ab dem Punkt angezeigt wird, an dem der &lt;more&gt;-tag steht. Wer dies in seinen Beitr&auml;gen verhindern m&ouml;chte, editiert die Datei <em>post-template.php</em> im WordPress-Verzeichnis <em>wp-includes</em> und sucht nach der Zeile<br />
<code>&sect;output .= ' &lt;a href="'. get_permalink() . "#more-&sect;id\" class=\"more-link\"&gt;&sect;more_link_text&lt;/a&gt;";</code><br />
und ersetzt diese gegen<br />
<code>&sect;output .= ' &lt;a href="'. get_permalink() . "\" class=\"more-link\"&gt;&sect;more_link_text&lt;/a&gt;";</code></p>
<p>Ab sofort werden alle Beitr&auml;ge, auch die mit dem &lt;more&gt;-tag, vom Anfang beginnend angezeigt. Einziger Nachteil dieser Methode: Nach einem Update von WordPress muss die &Auml;nderung wiederholt werden.</p>
<small style="text-color:#cccccc;">Copyright &copy; 2010 by <strong><a href="http://www.kopflos.eu">kopflos</a></strong>  | This feed is for personal non-commercial use only. If you are reading this feed outside your news reader, the site you are looking on violates the copyright.</small><hr/><img src="http://www.kopflos.eu/?ak_action=api_record_view&id=1052&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.kopflos.eu/kompletter-beitrag-nach-more-tag/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
