<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>oganosin blog&#187; function.php</title>
	<atom:link href="http://www.oganosin.net/blog/tag/functionphp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.oganosin.net/blog</link>
	<description>oganosin weblog</description>
	<lastBuildDate>Wed, 29 Sep 2010 03:00:00 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.oganosin.net/blog/tag/functionphp/feed/" />
		<item>
		<title>Ktai Style でメタタグを追加する方法</title>
		<link>http://www.oganosin.net/blog/wordpress/20090517/</link>
		<comments>http://www.oganosin.net/blog/wordpress/20090517/#comments</comments>
		<pubDate>Sun, 17 May 2009 06:04:10 +0000</pubDate>
		<dc:creator>oganosin</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[function.php]]></category>
		<category><![CDATA[Ktai Style]]></category>
		<category><![CDATA[携帯表示]]></category>

		<guid isPermaLink="false">http://www.oganosin.net/blog/?p=80</guid>
		<description><![CDATA[Ktai Styleで携帯表示を行っているとメタタグのkeywordとdescriptionが表示されないみたい。 All in one SEO pack と併用すればwp_head内で設定されるのかなーと思ったけれども [...]]]></description>
			<content:encoded><![CDATA[<p>Ktai Styleで携帯表示を行っているとメタタグのkeywordとdescriptionが表示されないみたい。<br />
All in one SEO pack と併用すればwp_head内で設定されるのかなーと思ったけれども、どうやら出力されない。というわけでKtai Style用のテーマのfunction.php内に以下のコードを追加して対応してみた。<br />
All in one SEO packとktai styleの併用はよくないようなのでしばらくこれで様子を見よう。</p>
<pre>
function addMetatags(){
	global $post;
	if(is_single() || is_page()){
		if( $post-&gt;post_excerpt != '' ){
			echo '&lt;meta name="description" content="' . $post-&gt;post_excerpt . '" /&gt;';
		}else{
			echo '&lt;meta name="description" content="'
				. htmlspecialchars($post-&gt;post_title)
				. '" /&gt;';
		}
		echo '&lt;meta name="Keywords" content="';
		foreach(get_the_tags($post-&gt;ID) as $tag ){
			echo $tag-&gt;name . ", ";
		}
		echo '" /&gt;';
	}elseif(is_category()){
		echo '&lt;meta name="description" content="'
			. htmlspecialchars(strip_tags(category_description()))
			. '" /&gt;';
		echo '&lt;meta name="Keywords" content="default keywords" /&gt;';
	}else{
		echo '&lt;meta name="description" content="default keywords" /&gt;';
		echo '&lt;meta name="Keywords" content="default keywords" /&gt;';
	}
}
add_action('wp_head', 'addMetatags');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.oganosin.net/blog/wordpress/20090517/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.oganosin.net/blog/wordpress/20090517/" />
	</item>
	</channel>
</rss>

