<?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>Snippet-Editor.com &#187; PHP</title>
	<atom:link href="http://snippet-editor.com/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://snippet-editor.com</link>
	<description>仕事で使えるHTML5・CSS3などのナイスなアイデアを収集しています。（一緒に投稿していただける方を募集中です）</description>
	<lastBuildDate>Sun, 10 Jul 2011 02:57:44 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>bodyのclassにカテゴリー名を入れる</title>
		<link>http://snippet-editor.com/2010/09/category-into-body-class.html</link>
		<comments>http://snippet-editor.com/2010/09/category-into-body-class.html#comments</comments>
		<pubDate>Sun, 26 Sep 2010 04:45:32 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[body class]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1345</guid>
		<description><![CDATA[WordPressを使って、Bodyタグのclassにカテゴリー名を入れるスニペット。ナビをハイライトさせたり、カテゴリごとにデザインを切り替えたりするのに使えます。]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
&lt;body class=&quot;&lt;?php if ( is_category() || is_single() ) { ?&gt;&lt;?php $cat = get_the_category(); $cat = $cat[0]; { echo $cat -&gt; category_nicename; } ?&gt;&lt;?php } ?&gt;&quot;&gt;
</pre>
<p><span id="more-1345"></span></p>
<p>WordPressを使って、Bodyタグのclassにカテゴリー名<sup>[<a href="#note">※</a>]</sup>を入れるスニペット。</p>
<p>ナビをハイライトさせたり、カテゴリごとにデザインを切り替えたりするのに使えます。</p>
<ol class="note" id="note">
<li>正確にはカテゴリーのスラッグ</li>
<li>スラッグが数字から始まったり、日本語が混じる場合はclass名に向いてませんので、あしからず…。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/category-into-body-class.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>検索窓に検索語句を残す</title>
		<link>http://snippet-editor.com/2010/09/wordpress-search-form-improvement.html</link>
		<comments>http://snippet-editor.com/2010/09/wordpress-search-form-improvement.html#comments</comments>
		<pubDate>Fri, 24 Sep 2010 03:05:56 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[placeholder]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[検索窓]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=1316</guid>
		<description><![CDATA[サイト内検索から検索して検索ページに行くと検索窓に検索語句が残ってないという残念な感じのWordPressテーマ向けスニペット。]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
&lt;form action=&quot;&lt;?php bloginfo('url'); ?&gt;/&quot; method=&quot;get&quot;&gt;
&lt;input type=&quot;text&quot; name=&quot;s&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; /&gt;
&lt;/form&gt;
</pre>
<p><span id="more-1316"></span></p>
<p>サイト内検索から検索ページに行くと検索窓に検索語句が残ってないという残念な感じのWordPressテーマに必要なスニペットです（上）。</p>
<p>当サイトではもう少し改良を加えました（下）。</p>
<pre class="brush: php;">
&lt;form action=&quot;&lt;?php bloginfo('url'); ?&gt;/&quot; method=&quot;get&quot;&gt;
&lt;input type=&quot;text&quot; class=&quot;text&quot; name=&quot;s&quot;
&lt;?php if ( is_search() ): ?&gt;
value=&quot;&lt;?php the_search_query(); ?&gt;&quot;
&lt;?php else: ?&gt;
value=&quot;Search&quot; onfocus=&quot;if(this.value=='Search')this.value=''&quot; onblur=&quot;if(this.value=='')this.value='Search'&quot;
&lt;?php endif; ?&gt;
 /&gt;
&lt;/form&gt;
</pre>
<p>これで普段は「Search」と表示され、検索ページでは検索語句が表示されるように。カラーリングには下のCSSを当てています。</p>
<pre class="brush: css;">
input.text { color: #888; }
input.text:focus { color: #222; background-color: #ffe; }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/wordpress-search-form-improvement.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPressでタイトルバーのSEOに一工夫</title>
		<link>http://snippet-editor.com/2010/09/wordpress-titlebar-seo.html</link>
		<comments>http://snippet-editor.com/2010/09/wordpress-titlebar-seo.html#comments</comments>
		<pubDate>Wed, 15 Sep 2010 21:07:43 +0000</pubDate>
		<dc:creator>tomohiro_kasuga</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[タイトルバー]]></category>

		<guid isPermaLink="false">http://snippet-editor.com/?p=951</guid>
		<description><![CDATA[何となくサイト名が左に来ないと気持ち悪いけどSEOが…という方にオススメのスニペット。]]></description>
			<content:encoded><![CDATA[<pre class="brush: php;">
&lt;title&gt;&lt;?php if ( is_single() ) { ?&gt;&lt;?php wp_title('&amp;laquo;',true,'right'); ?&gt;&lt;?php $cat = get_the_category(); $cat = $cat[0]; { echo $cat -&gt; cat_name . ' &amp;laquo; '; } ?&gt;&lt;?php } ?&gt;
&lt;?php bloginfo('name'); ?&gt;
&lt;?php if ( is_category() ) { ?&gt;&lt;?php wp_title(); ?&gt;&lt;?php } ?&gt;
&lt;?php if ( is_year() || is_month() || is_day() ) { ?&gt; &amp;raquo; Archive&lt;?php } ?&gt;
&lt;?php if ( is_author() ) { ?&gt; &amp;raquo; Author&lt;?php } ?&gt;
&lt;?php if ( is_search() || is_tag() ) { ?&gt; &amp;raquo; Search&lt;?php } ?&gt;
&lt;/title&gt;
</pre>
<p><span id="more-951"></span></p>
<p>記事の見出しをサイト名より左にした方がSEOに有利なのは有名な話ですが、このスニペットを使うと記事ページでは見出しを左に、記事ページ以外ではサイト名が左に来るように出来ます。</p>
<p>何となくサイト名が左に来ないと気持ち悪いけどSEOが…という方にオススメです。当Snippet-Editor.comもこれで実装してあります。</p>
<pre class="brush: php;">
&lt;?php if ( is_single() ) { ?&gt;&lt;?php wp_title('&amp;laquo;',true,'right'); ?&gt;&lt;?php $cat = get_the_category(); $cat = $cat[0]; { echo $cat -&gt; cat_name . ' &amp;laquo; '; } ?&gt;&lt;?php } ?&gt;
&lt;?php bloginfo('name'); ?&gt;
&lt;?php if ( is_category() ) { ?&gt;&lt;?php wp_title(); ?&gt;&lt;?php } ?&gt;
</pre>
<p>解説すると、1行目が記事見出し、2行目がサイト名、3行目以降がカテゴリーページなどの見出しとなっています。</p>
]]></content:encoded>
			<wfw:commentRss>http://snippet-editor.com/2010/09/wordpress-titlebar-seo.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

