<?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>Schnipsel - Code Schnipsel (Snippets) zu Wordpress, PHP, HTML, CSS, jQuery &#187; Wordpress</title>
	<atom:link href="http://schnipsel.davidhellmann.com/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://schnipsel.davidhellmann.com</link>
	<description>Code Schnipsel (Snippets) zu Wordpress, PHP, HTML, CSS, jQuery</description>
	<lastBuildDate>Tue, 08 Mar 2011 00:20:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>WordPress &#8211; Eine Seite ausgeben</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-eine-seite-ausgeben/68</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-eine-seite-ausgeben/68#comments</comments>
		<pubDate>Wed, 12 Aug 2009 05:46:11 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[pages]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=68</guid>
		<description><![CDATA[Will man sich zum Beispiel eigene Landingpages bauen oder auch nur die Startseite individuell gestalten braucht man hin und wieder einzelne Seiten die man einf&#252;gen m&#246;chte. Zum Beispiel einen kleinen About Text auf der Startseite oder &#228;hnliches. Mit dem folgenden Code kann man ganz einfach an Hand der Seiten ID diese anzeigen lassen. 1 2 [...]]]></description>
			<content:encoded><![CDATA[<p>
Will man sich zum Beispiel eigene Landingpages bauen oder auch nur die Startseite individuell gestalten braucht man hin und wieder einzelne Seiten die man einf&#252;gen m&#246;chte. Zum Beispiel einen kleinen About Text auf der Startseite oder &#228;hnliches. Mit dem folgenden Code kann man ganz einfach an Hand der Seiten ID diese anzeigen lassen.
</p>
<span id="more-68"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #666666; font-style: italic;">// retrieve one post with an ID of 5</span>
	query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page_id=9'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$more</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// set $more to 0 in order to only get the first part of the post</span>
	<span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</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;">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: #000000; font-weight: bold;">?&gt;</span>
	&lt;h2&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;/h2&gt;
  	<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read the full post »'</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> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-eine-seite-ausgeben/68/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Shortcodes erstellen</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-shortcodes-erstellen/64</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-shortcodes-erstellen/64#comments</comments>
		<pubDate>Tue, 30 Jun 2009 06:38:23 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[Shortcodes]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=64</guid>
		<description><![CDATA[Wenn man zum Beispiel einen oft wiederkehrende Zeichenfolge hat und man diese nicht immer schreiben m&#246;chte von Hand k&#246;nnte man die mit Shortcodes machen. 1 2 3 4 5 6 &#60;?php function makebetterwebsites&#40;&#41; &#123; return 'Make Better Websites - Webseitengallery f&#252;r wundersch&#246;ner und eindrucksvolle Webseiten.'; &#125; &#160; add_shortcode&#40;'mbw', 'makebetterwebsites'&#41;; ?&#62; Jetzt m&#252;sste man in WordPress [...]]]></description>
			<content:encoded><![CDATA[<p>Wenn man zum Beispiel einen oft wiederkehrende Zeichenfolge hat und man diese nicht immer schreiben m&#246;chte von Hand k&#246;nnte man die mit Shortcodes machen.
</p>
<span id="more-64"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">function</span> makebetterwebsites<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'Make Better Websites - Webseitengallery für wunderschöner und eindrucksvolle Webseiten.'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mbw'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'makebetterwebsites'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>



<p>
Jetzt m&#252;sste man in WordPress bei einem Artikel (HTML Editor) einfach [mbw] einsetzen und es w&#252;rde der Text: "Make Better Websites - Webseitengallery f&#252;r wundersch&#246;ner und eindrucksvolle Webseiten." erscheinen. 
</p>
<p>
Da kommt mir gerade die Idee, ob es so vielleicht m&#246;glich w&#228;re ganze Codeschnipsel die man oft braucht (z. B. Letzte Artikel ausgeben) einfach in solche Shortcodes packen k&#246;nnte und somit in den Templates relativ wenig code hat. Wer kann was dazu sagen?
<br /><br />
<strong>***UPDATE***</strong><br />
Ein kurzer plausch mit <a href="http://www.bueltge.de">Frank</a> und es kam raus das das so nicht m&#246;glich w&#228;re aber er hat mich auf eine andere Sache gesto&#223;en die im grunde &#228;hnlich einfach ist :)
</p>]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-shortcodes-erstellen/64/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Artikel anzeigen lassen (Loop)</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-artikel-anzeigen-lassen/55</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-artikel-anzeigen-lassen/55#comments</comments>
		<pubDate>Wed, 27 May 2009 07:41:38 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=55</guid>
		<description><![CDATA[Man kann ganz einfach Artikel auch woanders anzeigen lassen. Fern von der "index.php". Mann muss nur die Kategorien angeben und die Anzahl der Beitr&#228;ge die angezeigt werden sollen. Somit kann man &#252;berall Artikel ausgeben. Zum Beispiel f&#252;r weiter Artikel in der Sidebar oder &#228;hnliches. In folgenden Beispielt w&#252;rden aus der Kategorie (1, 2, 3) 20 [...]]]></description>
			<content:encoded><![CDATA[<p>
Man kann ganz einfach Artikel auch woanders anzeigen lassen. Fern von der "<strong>index.php</strong>". Mann muss nur die Kategorien angeben und die Anzahl der Beitr&#228;ge die angezeigt werden sollen. Somit kann man &#252;berall Artikel ausgeben. Zum Beispiel f&#252;r weiter Artikel in der Sidebar oder &#228;hnliches. In folgenden Beispielt w&#252;rden aus der Kategorie (1, 2, 3) 20 Artikel angezeigt werden (insgesamt).
</p>
<span id="more-55"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$myPosts</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$myPosts</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</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;">$my_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;">$my_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat=1,2,3&amp;showposts=20&amp;orderby=date'</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;">$my_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: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$my_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;">$my_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: #000088;">$myPosts</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: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;h2&gt;&lt;a id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<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; 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;/h2&gt;
&lt;div class=&quot;content&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<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;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</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></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-artikel-anzeigen-lassen/55/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; dynamischer Seitentitel</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-dynamischer-seitentitel/38</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-dynamischer-seitentitel/38#comments</comments>
		<pubDate>Wed, 13 May 2009 12:54:16 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=38</guid>
		<description><![CDATA[Man ist auf der Startseite und es wird im Tab des Browsers ein Titel angezeigt. Bei vielen Seiten ist es so, dass egal wo man sich auf der Seite befindet, der Titel immer der gleiche ist. Ein kleiner PHP Schnipsel fragt den Seitentyp ab und vergibt den Titel. Das ganze kommt in die "header.php" und [...]]]></description>
			<content:encoded><![CDATA[<p>
Man ist auf der Startseite und es wird im Tab des Browsers ein Titel angezeigt. Bei vielen Seiten ist es so, dass egal wo man sich auf der Seite befindet, der Titel immer der gleiche ist. Ein kleiner PHP Schnipsel fragt den Seitentyp ab und vergibt den Titel. Das ganze kommt in die "<strong>header.php</strong>" und muss das hier ersetzen: <strong>< title >bla blub< /title ></strong>.
</p>
<span id="more-38"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'	&lt;title&gt;'</span><span style="color: #339933;">;</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: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Blog's Home</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Home - '</span> <span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</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><span style="color: #0000ff;">'start'</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;">// Single blog post or page</span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</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_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> or is_page<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: #666666; font-style: italic;">// Single blog post or page</span>
	wp_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - '</span> <span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</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_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: #666666; font-style: italic;">// Archive: Category</span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' &amp;raquo; Kategorie: '</span><span style="color: #339933;">;</span> single_cat_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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_day<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: #666666; font-style: italic;">// Archive: By day</span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' &amp;raquo; Alle Weblogartikel vom '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'. '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</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_month<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: #666666; font-style: italic;">// Archive: By month </span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' &amp;raquo; Alle Weblogartikel vom '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</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_year<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: #666666; font-style: italic;">// Archive: By year</span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' &amp;raquo; Alle Weblogartikel vom Jahr '</span> <span style="color: #339933;">.</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</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_search<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: #666666; font-style: italic;">// Search</span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' &amp;raquo; Suche:  	&amp;lsaquo;'</span> <span style="color: #339933;">.</span> wp_specialchars<span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;rsaquo;'</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_404<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: #666666; font-style: italic;">// 404</span>
	<span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'  &amp;raquo; 404 - Angeforderte Seite nicht gefunden'</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: #666666; font-style: italic;">// Everything else. Fallback</span>
	bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> wp_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/title&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-dynamischer-seitentitel/38/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Post Revisions deaktivieren</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-post-revisions-deaktivieren/37</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-post-revisions-deaktivieren/37#comments</comments>
		<pubDate>Wed, 13 May 2009 09:08:14 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=37</guid>
		<description><![CDATA[Wordpress hat die Post Revisions standardm&#228;&#223;ig aktiviert. Dadurch sammeln sich viele Daten in der Datenbank. Wer es nicht ben&#246;tigt kann das ganz einfach abschalten. Und war muss einfach folgenden Codezeile in die "config.php" geschrieben werden. 1 define&#40;'WP_POST_REVISIONS', False&#41;;]]></description>
			<content:encoded><![CDATA[<p>
Wordpress hat die Post Revisions standardm&#228;&#223;ig aktiviert. Dadurch sammeln sich viele Daten in der Datenbank. Wer es nicht ben&#246;tigt kann das ganz einfach abschalten. Und war muss einfach folgenden Codezeile in die "<strong>config.php</strong>" geschrieben werden.
</p>
<span id="more-37"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_POST_REVISIONS'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">False</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-post-revisions-deaktivieren/37/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Fehler bei deaktiviertem Plugin verhindern</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-fehler-bei-deaktiviertem-plugin-verhindern/36</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-fehler-bei-deaktiviertem-plugin-verhindern/36#comments</comments>
		<pubDate>Wed, 13 May 2009 09:02:48 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=36</guid>
		<description><![CDATA[Von Andreas Isaak Um h&#228;ssliche Fehlermeldungen bei deaktivierten Plugins zu verhindern, bindet man dessen Funktionen mit entsprechendem Code ein. Hier wird einfach abgefragt ob das Plugin vorhanden ist. Wenn ja wird es ausgef&#252;hrt wenn nicht kommt einfach nichts. 1 2 3 &#60;?php if &#40;function_exists&#40;'pluginname'&#41;&#41; &#123; pluginname&#40;&#41;; &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>
Von Andreas Isaak<br /><br />
Um h&#228;ssliche Fehlermeldungen bei deaktivierten Plugins zu verhindern, bindet man dessen Funktionen mit entsprechendem Code ein. Hier wird einfach abgefragt ob das Plugin vorhanden ist. Wenn ja wird es ausgef&#252;hrt wenn nicht kommt einfach nichts.
</p>
<span id="more-36"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pluginname'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
	pluginname<span style="color: #009900;">&#40;</span><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></td></tr></table></div>



]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-fehler-bei-deaktiviertem-plugin-verhindern/36/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Automatische Weiterleitung zu einer Unterseite</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/wordpress-automatische-weiterleitung-zu-einer-unterseite/35</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/wordpress-automatische-weiterleitung-zu-einer-unterseite/35#comments</comments>
		<pubDate>Wed, 13 May 2009 08:58:59 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Weiterleitung]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=35</guid>
		<description><![CDATA[Von Andreas Isaak Jedes normale CMS bietet den Service, ein Hauptmen&#252;punkt anzulegen der dann automatisch zum ersten Untermen&#252;punkt weiterleitet. Gerade dann sinnvoll wenn man keinen Inhalt f&#252;r den Hauptmen&#252;punkt hat aber er zur Erkl&#228;rung oben stehen sollten. Leider bietet WordPress hier keine interne L&#246;sung, daher habe ich mir ein eigenes kleines Script geschrieben was in [...]]]></description>
			<content:encoded><![CDATA[<p>
Von Andreas Isaak<br /><br />
Jedes normale CMS bietet den Service, ein Hauptmen&#252;punkt anzulegen der dann automatisch zum ersten Untermen&#252;punkt weiterleitet. Gerade dann sinnvoll wenn man keinen Inhalt f&#252;r den Hauptmen&#252;punkt hat aber er zur Erkl&#228;rung oben stehen sollten.
Leider bietet WordPress hier keine interne L&#246;sung, daher habe ich mir ein eigenes kleines Script geschrieben was in die erste Zeile der header.php geh&#246;rt (noch vor dem Doctype)!
</p>
<span id="more-35"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'beispielseite'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	wp_redirect<span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/beispielseite'</span><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></td></tr></table></div>



]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/wordpress-automatische-weiterleitung-zu-einer-unterseite/35/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Kategorie&#252;bersicht formatieren</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/kategorieuebersicht-formatieren/30</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/kategorieuebersicht-formatieren/30#comments</comments>
		<pubDate>Thu, 07 May 2009 13:13:20 +0000</pubDate>
		<dc:creator>Thomas Aull</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=30</guid>
		<description><![CDATA[Bei WordPress kann man die Ausgaben teilweise nicht selbst formatieren, zum Beispiel bei der Kategorie&#252;bersicht. Mit der PHP-Funktion str_replace funktionierts &#252;ber einen kleinen Umweg aber trotzdem. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 &#160; &#60;?php &#160; // Hole die Kategorie&#252;bersicht, aber zeige sie noch [...]]]></description>
			<content:encoded><![CDATA[<p>Bei WordPress kann man die Ausgaben teilweise nicht selbst formatieren, zum Beispiel bei der Kategorie&#252;bersicht. Mit der PHP-Funktion str_replace funktionierts &#252;ber einen kleinen Umweg aber trotzdem.</p>

<span id="more-30"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
    <span style="color: #666666; font-style: italic;">// Hole die Kategorieübersicht, aber zeige sie noch nich an (echo = 0)</span>
    <span style="color: #000088;">$kategorien</span> <span style="color: #339933;">=</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=&amp;show_count=1&amp;echo=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Array, Inhalt: Suche nach diesen Stringmustern...</span>
    <span style="color: #000088;">$array_suchen</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'('</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">')'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// ...und ersetze sie durch diese</span>
    <span style="color: #000088;">$array_ersetzen</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span class=&quot;kleineschrift&quot;&gt;// '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' Einträge&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// str_replace durchführen</span>
    <span style="color: #000088;">$kategorien</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$array_suchen</span><span style="color: #339933;">,</span> <span style="color: #000088;">$array_ersetzen</span><span style="color: #339933;">,</span> <span style="color: #000088;">$kategorien</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Output</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$kategorien</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/kategorieuebersicht-formatieren/30/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Kategorie von der Startseite ausschlie&#223;en</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/kategorie-von-der-startseite-ausschliessen/23</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/kategorie-von-der-startseite-ausschliessen/23#comments</comments>
		<pubDate>Fri, 24 Apr 2009 13:19:23 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Function]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=23</guid>
		<description><![CDATA[Erm&#246;glicht das ausschlie&#223;en gewisser Kategorien von der Startseite. Kommt in die functions.php im Theme Ordner. 1 2 3 4 5 6 7 8 9 10 11 &#60;?php // Kategorie von Startseite ausschlie&#223;en function filter_posts&#40;&#41; &#123; global $wp_query; if&#40;is_home&#40;&#41;&#41; &#123; $wp_query-&#62;set&#40;'category__not_in',array&#40;49&#41;&#41;; &#125; &#125; &#160; add_action&#40;'pre_get_posts','filter_posts'&#41;; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>
Erm&#246;glicht das ausschlie&#223;en gewisser Kategorien von der Startseite. Kommt in die <strong>functions.php</strong> im Theme Ordner.
</p>
<span id="more-23"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #666666; font-style: italic;">// Kategorie von Startseite ausschließen</span>
	<span style="color: #000000; font-weight: bold;">function</span> filter_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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: #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: #009900;">&#123;</span>
			<span style="color: #000088;">$wp_query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'category__not_in'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">49</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'filter_posts'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>



]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/kategorie-von-der-startseite-ausschliessen/23/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bestimmte Kategorien nicht im RSS Feed anzeigen lassen</title>
		<link>http://schnipsel.davidhellmann.com/wordpress/bestimmte-kategorien-nicht-im-rss-feed-anzeigen-lassen/22</link>
		<comments>http://schnipsel.davidhellmann.com/wordpress/bestimmte-kategorien-nicht-im-rss-feed-anzeigen-lassen/22#comments</comments>
		<pubDate>Thu, 23 Apr 2009 17:55:24 +0000</pubDate>
		<dc:creator>David Hellmann</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[RSS Feed]]></category>

		<guid isPermaLink="false">http://schnipsel.davidhellmann.com/?p=22</guid>
		<description><![CDATA[Eine Funktion die es erm&#246;glicht, dass gewisse Kategorien nicht im RSS Feed angezeigt werden. Das ganze kommt in die functions.php des aktiven Themes. 1 2 3 4 5 6 7 8 9 10 11 &#60;?php // Kategorie von RSS ausschlie&#223;en function fb_cat_exclude&#40;$query&#41; &#123; if &#40;$query-&#62;is_feed&#41; &#123; $query-&#62;set&#40;'cat','-49'&#41;; &#125; return $query; &#125; &#160; add_filter&#40;'pre_get_posts','fb_cat_exclude'&#41;; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>
Eine Funktion die es erm&#246;glicht, dass gewisse Kategorien nicht im RSS Feed angezeigt werden. Das ganze kommt in die <strong>functions.php</strong> des aktiven Themes. 
</p>
<span id="more-22"></span>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #666666; font-style: italic;">// Kategorie von RSS ausschließen</span>
	<span style="color: #000000; font-weight: bold;">function</span> fb_cat_exclude<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</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: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_feed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'-49'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'fb_cat_exclude'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


]]></content:encoded>
			<wfw:commentRss>http://schnipsel.davidhellmann.com/wordpress/bestimmte-kategorien-nicht-im-rss-feed-anzeigen-lassen/22/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

