<?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>wlsy &#187; 主题</title>
	<atom:link href="http://wlsy.me/tag/%e4%b8%bb%e9%a2%98/feed/" rel="self" type="application/rss+xml" />
	<link>http://wlsy.me</link>
	<description>当时的月亮 今天的阳光</description>
	<lastBuildDate>Tue, 24 Aug 2010 02:48:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>wordpress双人主题制作思路</title>
		<link>http://wlsy.me/1439/</link>
		<comments>http://wlsy.me/1439/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 20:17:28 +0000</pubDate>
		<dc:creator>wlsy</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://www.g9net.com/2009/03/13/double-wordpress-theme-ideas.html</guid>
		<description><![CDATA[前不久看到这个，感觉以后用上又怕找不到，所以找来存档分析。
这个网站（http://rin-wendy.com/）的布局很特别，首页是三栏，左右不同的颜色，文章页根据不同的作者显示不同的颜色，页面又是一种风格。

1. 首先区分页面，首页，作者A和作者B。
&#60;?php if (is_page())  {
$style_item = &#8216;page&#8217;;
} elseif (is_single()) {
if ($post-&#62;post_author == &#8216;1&#8242;) {
$style_item = &#8216;left&#8217;;
}
elseif ($post-&#62;post_author == &#8216;2&#8242;) {
$style_item = &#8216;right&#8217;;
}
} else {
$style_item = &#8216;normal&#8217;;
} ?&#62;
把定义的$style_item加在DIV框架内，以方便用CSS控制显示。
&#60;div id=&#8221;page&#8221; class=&#8221;wrap-&#60;?php echo($style_item); ?&#62;&#8221;&#62;
2. 首页左右作者的实现可以用query_posts来控制
一开始用query_posts(’author=1′ ) 发现这样不能正常分页，查找了相关资料最后找到了如下代码:
&#60;?php
$limit = get_option(&#8216;posts_per_page&#8217;);
$paged = (get_query_var(&#8216;paged&#8217;)) ? get_query_var(&#8216;paged&#8217;) : 1;
query_posts(&#8216;author=1&#8242; . &#8216;&#38;paged=&#8217; . $paged);
?&#62;
注意: 
&#60;?php endwhile; ?&#62;
下方加上一句
&#60;?php wp_reset_query(); ?&#62;
不加的话会使侧栏的if (is_category())这样的判断失效。
评论部分：
1. 修改comments.php，在wp_list_comments代码那加上&#38;callback=my_comment。
&#60;?php wp_list_comments(&#8216;type=comment&#38;callback=my_comment&#8217;); ?&#62;
2. [...]]]></description>
			<content:encoded><![CDATA[<p>前不久看到这个，感觉以后用上又怕找不到，所以找来存档分析。</p>
<p>这个网站（http://rin-wendy.com/）的布局很特别，首页是三栏，左右不同的颜色，文章页根据不同的作者显示不同的颜色，页面又是一种风格。</p>
<p><span id="more-1439"></span></p>
<p>1. 首先区分页面，首页，作者A和作者B。<br />
&lt;?php if (is_page())  {<br />
$style_item = &#8216;page&#8217;;<br />
} elseif (is_single()) {<br />
if ($post-&gt;post_author == &#8216;1&#8242;) {<br />
$style_item = &#8216;left&#8217;;<br />
}<br />
elseif ($post-&gt;post_author == &#8216;2&#8242;) {<br />
$style_item = &#8216;right&#8217;;<br />
}<br />
} else {<br />
$style_item = &#8216;normal&#8217;;<br />
} ?&gt;<br />
把定义的$style_item加在DIV框架内，以方便用CSS控制显示。<br />
&lt;div id=&#8221;page&#8221; class=&#8221;wrap-&lt;?php echo($style_item); ?&gt;&#8221;&gt;<br />
2. 首页左右作者的实现可以用query_posts来控制<br />
一开始用query_posts(’author=1′ ) 发现这样不能正常分页，查找了相关资料最后找到了如下代码:<br />
&lt;?php<br />
$limit = get_option(&#8216;posts_per_page&#8217;);<br />
$paged = (get_query_var(&#8216;paged&#8217;)) ? get_query_var(&#8216;paged&#8217;) : 1;<br />
query_posts(&#8216;author=1&#8242; . &#8216;&amp;paged=&#8217; . $paged);<br />
?&gt;<br />
<strong>注意: </strong><br />
&lt;?php endwhile; ?&gt;<br />
下方加上一句<br />
&lt;?php wp_reset_query(); ?&gt;<br />
不加的话会使侧栏的if (is_category())这样的判断失效。<br />
评论部分：<br />
1. 修改comments.php，在wp_list_comments代码那加上&amp;callback=my_comment。<br />
&lt;?php wp_list_comments(&#8216;type=comment&amp;callback=my_comment&#8217;); ?&gt;<br />
2. 修改function.php，加入如下代码<br />
function my_comment($comment, $args, $depth) {<br />
$GLOBALS['comment'] = $comment; ?&gt;<br />
&lt;li &lt;?php love_class(); ?&gt; id=&#8221;li-comment-&lt;?php comment_ID() ?&gt;&#8221;&gt;<br />
&lt;div id=&#8221;comment-&lt;?php comment_ID(); ?&gt;&#8221;&gt;<br />
&lt;div class=&#8221;comment-text&#8221;&gt;<br />
&lt;div class=&#8221;comment-text-top&#8221;&gt;&amp;nbsp;&lt;/div&gt;<br />
&lt;?php comment_text() ?&gt;<br />
&lt;?php if ($comment-&gt;comment_approved == &#8216;0&#8242;) : ?&gt;<br />
&lt;em&gt;&lt;?php _e(&#8216;Your comment is awaiting moderation.&#8217;) ?&gt;&lt;/em&gt;<br />
&lt;?php endif; ?&gt;<br />
&lt;?php edit_comment_link(__(&#8216;(Edit)&#8217;),&#8217;  &#8216;,&#8221;) ?&gt;<br />
&lt;div class=&#8221;comment-text-bot&#8221;&gt;&amp;nbsp;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;comment-author vcard&#8221;&gt;<br />
&lt;?php echo get_avatar($comment,$size=&#8217;48&#8242;,$default=&#8217;&lt;path_to_url&gt;&#8217; ); ?&gt;<br />
&lt;?php printf(__(&#8216;&lt;cite class=&#8221;fn&#8221;&gt;%s&lt;/cite&gt; &lt;span class=&#8221;says&#8221;&gt;says:&lt;/span&gt;&#8217;), get_comment_author_link()) ?&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;comment-meta commentmetadata&#8221;&gt;<br />
&lt;?php printf(__(&#8216;%1$s at %2$s&#8217;), get_comment_date(),  get_comment_time()) ?&gt;<br />
&lt;/div&gt;<br />
&lt;/div&gt;<br />
}<br />
3. function.php，加入如下代码<br />
function love_class( $class = &#8221;, $comment_id = null, $post_id = null, $echo = true ) {<br />
// Separates classes with a single space, collates classes for comment DIV<br />
$class = &#8216;class=&#8221;&#8216; . join( &#8216; &#8216;, love_comment_class( $class, $comment_id, $post_id ) ) . &#8216;&#8221;&#8216;;<br />
if ( $echo)<br />
echo $class;<br />
else<br />
return $class;<br />
}<br />
function love_comment_class( $class = &#8221;, $comment_id = null, $post_id = null ) {<br />
global $comment_alt, $comment_depth, $comment_thread_alt;<br />
$comment = get_comment($comment_id);<br />
$classes = array();<br />
// Get the comment type (comment, trackback),<br />
$classes[] = ( empty( $comment-&gt;comment_type ) ) ? &#8216;comment&#8217; : $comment-&gt;comment_type;<br />
// If the comment author has an id (registered), then print the log in name<br />
if ( $comment-&gt;user_id &gt; 0 &amp;&amp; $user = get_userdata($comment-&gt;user_id) ) {<br />
// For all registered users, &#8216;byuser&#8217;<br />
$classes[] = &#8216;byuser comment-author-&#8217; . $user-&gt;user_nicename;<br />
// For comment authors who are the author of the post<br />
if ( $post = get_post($post_id) ) {<br />
if ( $comment-&gt;user_id === $post-&gt;post_author )<br />
$classes[] = &#8216;bypostauthor&#8217;;<br />
}<br />
}<br />
if ( empty($comment_alt) )<br />
$comment_alt = 0;<br />
if ( empty($comment_depth) )<br />
$comment_depth = 1;<br />
if ( empty($comment_thread_alt) )<br />
$comment_thread_alt = 0;<br />
if ( $comment_alt % 2 ) {<br />
if ( $comment-&gt;user_id &gt; 0 &amp;&amp; $user = get_userdata($comment-&gt;user_id) ) {<br />
$classes[] = &#8216;odd-&#8217; . $user-&gt;user_login;<br />
$classes[] = &#8216;alt-&#8217; . $user-&gt;user_login;<br />
} else {<br />
$classes[] = &#8216;odd&#8217;;<br />
$classes[] = &#8216;alt&#8217;;<br />
}<br />
} else {<br />
if ( $comment-&gt;user_id &gt; 0 &amp;&amp; $user = get_userdata($comment-&gt;user_id) ) {<br />
$classes[] = &#8216;even-&#8217; . $user-&gt;user_login;<br />
} else {<br />
$classes[] = &#8216;even&#8217;;<br />
}<br />
}<br />
$comment_alt++;<br />
// Alt for top-level comments<br />
if ( 1 == $comment_depth ) {<br />
if ( $comment_thread_alt % 2 ) {<br />
$classes[] = &#8216;thread-odd&#8217;;<br />
$classes[] = &#8216;thread-alt&#8217;;<br />
} else {<br />
$classes[] = &#8216;thread-even&#8217;;<br />
}<br />
$comment_thread_alt++;<br />
}<br />
$classes[] = &#8220;depth-$comment_depth&#8221;;<br />
if ( !empty($class) ) {<br />
if ( !is_array( $class ) )<br />
$class = preg_split(&#8216;#s+#&#8217;, $class);<br />
$classes = array_merge($classes, $class);<br />
}<br />
return apply_filters(&#8216;comment_class&#8217;, $classes, $class, $comment_id, $post_id);<br />
}<br />
转自<a title="http://www.koryi.net/wp/664.html" href="http://www.koryi.net/wp/664.html">http://www.koryi.net/wp/664.html</a><br />
<strong>说一下我自己的思路：</strong><br />
我当时的想法是：假如有作者A，作者B.那么我们就可以将其定义为class属性名。比如&lt;div class=”A”&gt;然后&lt;div class=”B”&gt;然后通过css来分别控制其显示效果。<br />
而评论留言的区别这个我感觉也没必要考虑。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlsy.me/1439/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
