<?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>WPCMS.jp &#187; スタイルシート</title>
	<atom:link href="http://wpcms.jp/tag/%e3%82%b9%e3%82%bf%e3%82%a4%e3%83%ab%e3%82%b7%e3%83%bc%e3%83%88/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpcms.jp</link>
	<description>WordPressをCMSとした企業サイトやポータルサイト、Webサービス開発方法やTipsなど。 ファーストエレメントが運営する、WordPressに特化した技術系ブログ。</description>
	<lastBuildDate>Sat, 24 Dec 2011 15:54:27 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://wpcms.jp/tag/%e3%82%b9%e3%82%bf%e3%82%a4%e3%83%ab%e3%82%b7%e3%83%bc%e3%83%88/feed/" />
		<item>
		<title>自分（Author）のコメントだけ背景色を変える。</title>
		<link>http://wpcms.jp/183/</link>
		<comments>http://wpcms.jp/183/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 13:32:42 +0000</pubDate>
		<dc:creator>みやざわ</dc:creator>
				<category><![CDATA[カスタマイズ/ハック]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[カスタマイズ]]></category>
		<category><![CDATA[スタイルシート]]></category>
		<category><![CDATA[データベース]]></category>

		<guid isPermaLink="false">https://sv69.xserver.jp/~fe01/wordpress4cms.net/183/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><strong>WordPress</strong>の<strong>コメント</strong>欄についてのカスタマイズ。</p>
<p>■目的：<br />
WordPressブログのコメント欄にて、ブログオーナー（記事のAuthor）が書いたコメントだけ、背景色（その他CSS）を変えて、他のコメンターと区別できるようにする。</p>
<p>■現状：<br />
そのコメントが記事投稿者のものかどうか確認するには、そのコメント投稿者名と記事の投稿者名を照らし合わせる必要がある。</p>
<p><span id="more-183"></span><br />
　<br />
■方法：<br />
１．スタイルシートにAuthorコメント用の設定を追加する。</p>
<div class="code">.<span style="color:#FF6500;">authcomment</span> {<br />
background-color: #B3FFCC !important;<br />
}</div>
<p>２．/wp-content/themes/使用中のテーマ/comments.php を開き、</p>
<div class="code">＜li id=&#8221;comment-＜?php comment_ID() ?＞&#8221;＞</div>
<p>このような部分を見付け、下記のように追記。</p>
<div class="code">＜li id=&#8221;comment-＜?php comment_ID() ?＞&#8221;<span style="color:#FF6500;">＜?php<br />
if (1 == $comment->user_id)<br />
$oddcomment = &#8220;authcomment&#8221;;<br />
echo &#8216;class=&#8221;&#8216; . $oddcomment; ?＞&#8221;</span>＞</div>
<p>例：テーマ「EasyAll」の場合15行目</p>
<p>以上。</p>
<p>■解説：<br />
もしコメントのユーザーIDが「1」だったら、そのコメントを囲むdivに「class=&#8221;authcomment&#8221;」が付加される。この場合の「ユーザーID」とは、WordPressブログの登録ユーザーのID。未登録のユーザーが投稿したコメントのuser_idは「0」になる。phpMyadminでMySQLのデータベースのwp_○○○_commentsをのぞくと、「user_id」という欄に「0」が並び、自分が返信した記事のコメントにだけ「1」が入っている。</p>
<p>しかし登録ユーザーでも未ログイン状態で投稿すると「0」になってしまう（はず）なので注意。</p>
<p>また、ユーザーIDが「4」だったら、上記のコードのif (<span style="color:#FF6500;">1</span> == は「<span style="color:#FF6500;">4</span>」になる。</p>
<p>情報源）<br />
<a href="http://www.mattcutts.com/blog/highlight-author-comments-wordpress/" target="_blank">How to highlight author comments in WordPress</a> Matt Cutts: Gadgets, Google, and SEO (2008/1/31)<br />
※リンク先の緑色のコメント欄がブログオーナー＝記事オーサーのコメント。</p>
<p>元ネタはこちらのようです→</p>
<p><a href="http://wordpress.org/support/topic/145946#post-657081" title="http://wordpress.org/support/topic/145946#post-657081" class="autohyperlink" target="_blank">wordpress.org/support/topic/145946#post-657081</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wpcms.jp/183/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://wpcms.jp/183/" />
	</item>
	</channel>
</rss>

