<?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>Axiu Blog &#187; WP技巧</title>
	<atom:link href="http://axiu.me/tag/wp-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://axiu.me</link>
	<description>又一个WordPress博客</description>
	<lastBuildDate>Fri, 03 Feb 2012 02:32:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>WP主题的“音乐样式”小结</title>
		<link>http://axiu.me/learning_notes/wp_audio_format/</link>
		<comments>http://axiu.me/learning_notes/wp_audio_format/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 01:19:36 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1313</guid>
		<description><![CDATA[文章样式是WP3.1版本推出的一个新功能，虽然对于老博客来说用处不是很大（因为要操作的文章比较多），所以“能见度”很低……我在刚推出的那段时间也试着折腾了一些，一直用到现在，基本来说，仿微博客，但貌似不很成功……有同学提到如何实现，所以本篇就介绍一下ink主题目前使用的“音乐样式”。 主题老鸟可以略过本篇内容，或截取使用。因为具体过程完全可以参考官方的twentyeleven……话不多说，上代码~~ 1、function.php里注册相应的样式名称，例如我加的：add_theme_support(&#8216;post-formats&#8217;, &#8216;audio&#8217;); 2、index.php里面while(have_posts()) : the_post();?>这一行，直到endwhile; ?>之间的内容剪切下来，改成如下样式： &#60;?php if&#40;have_posts&#40;&#41;&#41; : ?&#62;&#60;?php while&#40;have_posts&#40;&#41;&#41; : the_post&#40;&#41;; ?&#62; &#60;?php get_template_part&#40; 'content', get_post_format&#40;&#41; &#41;; ?&#62; &#60;?php endwhile; ?&#62; 3、主题目录下新建文件content.php，把第二步剪切下来的内容粘贴到里面，存储，这主要是设置默认的显示样式； 4、复制一份content.php，重命名为content-audio.php，这个便是要定义的音乐样式了。把the_content()这一行删掉，写入需要显示的内容，例如我增加了5个内容： &#60;?php $soContent = $post-&#62;post_content; $soImages = '~&#60;img [^\&#62;]*\ /&#62;~'; preg_match_all&#40; $soImages, $soContent, $thePics &#41;; $allPics = count&#40;$thePics&#91;0&#93;&#41;; echo '&#60;div class=&#34;audioback&#34;&#62;&#60;a href=&#34;'; echo the_permalink&#40;&#41;; echo '&#34; rel=&#34;nofollow&#34;&#62;&#60;div class=&#34;overlay&#34;&#62;&#60;/div&#62;'; if&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>文章样式是WP3.1版本推出的一个新功能，虽然对于老博客来说用处不是很大（因为要操作的文章比较多），所以“能见度”很低……我在刚推出的那段时间也试着折腾了一些，一直用到现在，基本来说，仿微博客，但貌似不很成功……有同学提到如何实现，所以本篇就介绍一下ink主题目前使用的“音乐样式”。</p>
<p>主题老鸟可以略过本篇内容，或截取使用。因为具体过程完全可以参考官方的twentyeleven……话不多说，上代码~~<span id="more-1313"></span></p>
<p>1、<strong>function.php</strong>里注册相应的样式名称，例如我加的：add_theme_support(&#8216;post-formats&#8217;, &#8216;audio&#8217;);</p>
<p>2、<strong>index.php</strong>里面while(have_posts()) : the_post();?>这一行，直到endwhile; ?>之间的内容剪切下来，改成如下样式：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</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> <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>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> get_template_part<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'content'</span><span style="color: #339933;">,</span> get_post_format<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: #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></div></div>

<p>3、主题目录下新建文件<strong>content.php</strong>，把第二步剪切下来的内容粘贴到里面，存储，这主要是设置默认的显示样式；</p>
<p>4、复制一份<strong>content.php</strong>，重命名为<strong>content-audio.php</strong>，这个便是要定义的音乐样式了。把the_content()这一行删掉，写入需要显示的内容，例如我增加了5个内容：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000088;">$soContent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$soImages</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'~&lt;img [^\&gt;]*\ /&gt;~'</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$soImages</span><span style="color: #339933;">,</span> <span style="color: #000088;">$soContent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$thePics</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$allPics</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thePics</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;audioback&quot;&gt;&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot; rel=&quot;nofollow&quot;&gt;&lt;div class=&quot;overlay&quot;&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$allPics</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$thePics</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</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: #b1b100;">echo</span> <span style="color: #0000ff;">'你的默认图片地址'</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//改为你需要的图片地址</span>
        <span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>  
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>以上内容为获取并显示文章第一张图片<br />
<strong>update 11.12.17</strong>:默认图片，感谢 phoetry</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000088;">$soContent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$soMedia</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'~&lt;embed [^\&gt;]*\ /&gt;~'</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$soMedia</span><span style="color: #339933;">,</span> <span style="color: #000088;">$soContent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$theMidea</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$allMedia</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$themedia</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</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;">$allMedia</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;audio&quot;&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$themedia</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>以上内容为获取并显示第一个内嵌的播放器，接下来格式输出~~</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;">&lt;div class=&quot;audioauthor&quot;&gt;
    &lt;a 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; 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; rel=&quot;bookmark&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;/div&gt;
&lt;div class=&quot;audioviews&quot;&gt;
    Played <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_views<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span class=&quot;playtime&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> times
&lt;/div&gt;
&lt;a 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>#comments&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; rel=&quot;bookmark&quot;&gt;
    &lt;div class=&quot;more-play&quot;&gt;
        &lt;span class=&quot;yplay&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_number<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'占个前排'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'1 位听众'</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: #000000; font-weight: bold;">?&gt;</span>
        &lt;/span&gt;
    &lt;/div&gt;
&lt;/a&gt;</pre></div></div>

<p>这就是所有关键步骤了。除此之外再根据主题具体需要定义一下css样式就可以了，对于做过主题的盆友来说这一步一定不是问题~~</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="WP主题的“音乐样式”小结" href="http://axiu.me/learning_notes/wp_audio_format/">《WP主题的“音乐样式”小结》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="WP主题的“音乐样式”小结" href="http://axiu.me/learning_notes/wp_audio_format/">http://axiu.me/learning_notes/wp_audio_format/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/wp_audio_format/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>ajax获取WordPress边栏信息（二）</title>
		<link>http://axiu.me/learning_notes/ajax_get_wordpress_sidebar_2/</link>
		<comments>http://axiu.me/learning_notes/ajax_get_wordpress_sidebar_2/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 14:11:31 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1311</guid>
		<description><![CDATA[上一次的文章可能说的太含糊了，所以部分朋友提出了一些疑问（我太偷懒了），所以经过很很长时间的考虑，终于决定在今天写第二部分。相对于前一篇，本篇是威力加强版，增加的内容主要有：1、如何输入两个参数；2、提供完整的代码。欢迎继续观看。 ==>上篇链接：ajax获取WordPress边栏信息（一） jQuery官方给出的ajax的例子不再叙述，相信很多同学由于英语或者其他原因，看了也是有点不太明白肿么回事。我这里主要说说在WordPress里怎样通过它来控制侧边栏的异步获取和输出，就像前一篇所说的那样。还有某些朋友好奇的：目前的ink主题侧栏的点击某项目才调取相关内容。关于这个依然需要3个步骤： 1、function.php里写入相应的函数 function AjaxLoad&#40;&#41;&#123; if&#40; isset&#40;$_GET&#91;'action'&#93;&#41;&#41;&#123; if&#40;$_GET&#91;'action'&#93; == 'ajax_slidepage' &#41;&#123; if&#40;$_GET&#91;'page'&#93; == 'pagenum2'&#41;&#123; echo '&#60;ul&#62;'; get_most_viewed&#40;'',8,0 ,0 ,' 次浏览'&#41;;//这个相信都知道是什么吧……被浏览最多的文章 echo '&#60;/ul&#62;&#60;p&#62;'; &#125; else&#123; echo '&#60;ul&#62;'; get_archives&#40;'postbypost', 8&#41;; echo '&#60;/ul&#62;&#60;p&#62;'; &#125; die; &#125; &#125; &#125; addaction&#40;'init', 'AjaxLoad'&#41;; 上面这段函数里，主要完成了两件事：获取action和page的值；显示相应的内容。其中前一步骤即是本文重点&#8211;两个（或多个）参数的输出。如何确定这个参数呢？这就需要下面的步骤完成了： 2、js部分： function ajaxslidepage&#40;b,c&#41; &#123; $.ajax&#40;&#123; url: 'http://127.0.0.1/?action=ajax_slidepage&#38;page='+c, type: 'get', beforeSend: function&#40;&#41; &#123; var loading = '载入中'; [...]]]></description>
			<content:encoded><![CDATA[<p>上一次的文章可能说的太含糊了，所以部分朋友提出了一些疑问（我太偷懒了），所以经过很很长时间的考虑，终于决定在今天写第二部分。相对于前一篇，本篇是威力加强版，增加的内容主要有：1、如何输入两个参数；2、提供完整的代码。欢迎继续观看。</p>
<p><strong>==>上篇链接：</strong><a href="http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/" title="ajax获取WordPress边栏信息（一）" target="_blank">ajax获取WordPress边栏信息（一）</a></p>
<p>jQuery官方给出的ajax的例子不再叙述，相信很多同学由于英语或者其他原因，看了也是有点不太明白肿么回事。我这里主要说说在WordPress里怎样通过它来控制侧边栏的异步获取和输出，就像前一篇所说的那样。还有某些朋友好奇的：目前的ink主题侧栏的点击某项目才调取相关内容。关于这个依然需要3个步骤：<span id="more-1311"></span></p>
<h3>1、function.php里写入相应的函数</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">function</span> AjaxLoad<span style="color: #009900;">&#40;</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: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ajax_slidepage'</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;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'pagenum2'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span><span style="color: #339933;">;</span>
                get_most_viewed<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">,</span><span style="color: #cc66cc;">0</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;">//这个相信都知道是什么吧……被浏览最多的文章</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;&lt;p&gt;'</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: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span><span style="color: #339933;">;</span>
                get_archives<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'postbypost'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;&lt;p&gt;'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #990000;">die</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
addaction<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'AjaxLoad'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>上面这段函数里，主要完成了两件事：获取action和page的值；显示相应的内容。其中前一步骤即是本文重点&#8211;两个（或多个）参数的输出。如何确定这个参数呢？这就需要下面的步骤完成了：</p>
<h3>2、js部分：</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family: Courier New,clearSys;">    <span style="color: #003366; font-weight: bold;">function</span> ajaxslidepage<span style="color: #009900;">&#40;</span>b<span style="color: #339933;">,</span>c<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://127.0.0.1/?action=ajax_slidepage&amp;page='</span><span style="color: #339933;">+</span>c<span style="color: #339933;">,</span>
            type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'get'</span><span style="color: #339933;">,</span>
            beforeSend<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003366; font-weight: bold;">var</span> loading <span style="color: #339933;">=</span> <span style="color: #3366CC;">'载入中'</span><span style="color: #339933;">;</span>
                $<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>loading<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'载入失败'</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>注意这段语句中action=ajax_slidepage&#038;page=&#8217;+c这一行，这就是步骤1中$_GET['action']和$_GET['page']的具体所指。</p>
<p>接着定义具体的点击行为：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family: Courier New,clearSys;">    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider4 .pager a.pagenum'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider4 .pagenum'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        next <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rel'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        next <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>next<span style="color: #339933;">*</span><span style="color: #CC0000;">305</span><span style="color: #339933;">;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slider4 .overview'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'left'</span><span style="color: #339933;">:</span>next<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #006600; font-style: italic;">//点击后的滑动效果</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> id <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//获取点击的该pager的id</span>
        <span style="color: #003366; font-weight: bold;">var</span> show <span style="color: #339933;">=</span> id <span style="color: #339933;">==</span> <span style="color: #3366CC;">'pagenum2'</span><span style="color: #339933;">?</span><span style="color: #3366CC;">'#page2'</span><span style="color: #339933;">:</span><span style="color: #3366CC;">'#page3'</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//根据id查找下面对应显示的项目</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>show<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//判断，使仅载入一次</span>
        ajaxslidepage<span style="color: #009900;">&#40;</span>show<span style="color: #339933;">,</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//调用，在id=xx中显示对应内容</span>
        <span style="color: #009900;">&#125;</span>
        event.<span style="color: #660066;">preventDefault</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//阻止默认行为（此处为链接点击）</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>3、呼，下面是边栏写入的内容：</h3>
<p>（注意，这里集成了侧栏的滑动pager效果，具体见ink主题的newcomments&#8230;部分）</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #339933;">&lt;</span>li id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;slider4&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pager&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pagenum&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">&gt;</span>NewComments<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pagenum&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pagenum2&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">&gt;</span>HotPosts<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pagenum&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;pagenum3&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #339933;">&gt;</span>NewPosts<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>							
	<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;viewport&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;overview&quot;</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;width: 1500px; left: 0px; &quot;</span><span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>li <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page&quot;</span><span style="color: #339933;">&gt;</span>
				<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;recentcomments&quot;</span><span style="color: #339933;">&gt;</span>
				我用的是最近评论，这个推荐
                                zww大叔的方法 http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//zww.me/archives/24818</span>
				<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>li <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page2&quot;</span><span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>li <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page3&quot;</span><span style="color: #339933;">&gt;&lt;/</span>li<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></div></div>

<p>我目前用的css代码也贴出来吧：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family: Courier New,clearSys;"><span style="color: #cc00cc;">#slider4</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1%</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">16px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.viewport</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">308px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#e3e3e3</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#e3e3e3</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#e3e3e3</span><span style="color: #00AA00;">;</span>background-<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>height<span style="color: #00AA00;">:</span> <span style="color: #933;">277px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.pager</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ddd</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1%</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.pager</span> <span style="color: #6666ff;">.micon</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-147px</span> <span style="color: #933;">-40px</span><span style="color: #00AA00;">;</span>margin-<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span><span style="color: #933;">7px</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span>  <span style="color: #cc00cc;">#pagenum2</span> <span style="color: #6666ff;">.micon</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span><span style="color: #933;">-72px</span> <span style="color: #933;">-40px</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span>  <span style="color: #cc00cc;">#pagenum3</span> <span style="color: #6666ff;">.micon</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span><span style="color: #933;">-48px</span> <span style="color: #933;">-40px</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.pager</span> li <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.pagenum</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#555555</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">60px</span><span style="color: #00AA00;">;</span>line-<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>height<span style="color: #00AA00;">:</span><span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>text-indent<span style="color: #00AA00;">:</span><span style="color: #933;">-9999px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#3E3E3E</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span>  <span style="color: #cc00cc;">#BBB</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span><span style="color: #933;">158px</span><span style="color: #00AA00;">;</span>text-indent<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.overview</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">308px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>top<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> <span style="color: #6666ff;">.overview</span> .<span style="color: #000000; font-weight: bold;">page</span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">265px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">310px</span><span style="color: #00AA00;">;</span>line-<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">23px</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#page2</span><span style="color: #00AA00;">,</span><span style="color: #cc00cc;">#page3</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">7px</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#slider4</span> .<span style="color: #000000; font-weight: bold;">page</span> ul li<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span> <span style="color: #933;">6px</span> <span style="color: #933;">4px</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#9a9a9a</span><span style="color: #00AA00;">;</span>list-style<span style="color: #00AA00;">:</span><span style="color: #993333;">circle</span> <span style="color: #993333;">inside</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>其实主要的就是步骤1和2，这里用到的主要是ajax的get方法，当然还有post方法，这个还没搞清楚区别，留待以后分析。</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="ajax获取WordPress边栏信息（二）" href="http://axiu.me/learning_notes/ajax_get_wordpress_sidebar_2/">《ajax获取WordPress边栏信息（二）》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="ajax获取WordPress边栏信息（二）" href="http://axiu.me/learning_notes/ajax_get_wordpress_sidebar_2/">http://axiu.me/learning_notes/ajax_get_wordpress_sidebar_2/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/ajax_get_wordpress_sidebar_2/feed/</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>ajax获取WordPress边栏信息（一）</title>
		<link>http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/</link>
		<comments>http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 10:30:16 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1299</guid>
		<description><![CDATA[对于技术这种东西，始终觉得现在用的很多以后都是会被摒弃的，死抱着一棵救命稻草终究会被湮没在历史的洪流之中。所以，某些技术只是拿来用用就可以了，内在始终不想去了解，大体上能完成功能即可。比如jquery，几次想看看书里怎么写又觉得没什么用处，偶尔到图书馆看到中外这类的书籍若干，拿起来又放下。终究是自己兴趣所在才有动力完成下去啊~ 最近有俩同学问题我边栏种马回事……我沉思了若干秒，总结出目前用的这个叫jquery的ajax方式异步获取（自己随便写的名字 &#8211; -&#124;）的玩意。原型忘记是什么了，记得是 winy 那边的一个什么栗子…… 首先我来举个栗子……栗子栗子栗子，每周都吃栗子。 1、首先要有加载jquery库； 2、在自己要载入的js文件里写入： function ajaxs&#40;&#41; &#123; $.ajax&#40;&#123; url: 'http://127.0.0.1/?action=ajax', //域名换成你要用的 type: 'get', beforeSend: function&#40;&#41; &#123; var loading = '&#60;span class=&#34;loadsidebar&#34;&#62;&#60;/span&#62;'; $&#40;'#hotposts'&#41;.empty&#40;&#41;.html&#40;loading&#41; //显示loading啊神马的 &#125;, error: function&#40;a&#41; &#123; $&#40;'#hotposts'&#41;.hide&#40;&#41;.empty&#40;&#41;.html&#40;'&#60;div style=&#34;text-align:center;padding-top:20px;&#34;&#62;还木有载好&#60;/div&#62;'&#41;.fadeIn&#40;'fast'&#41; &#125;, //错误时输出神马 success: function&#40;a&#41; &#123; $&#40;'#hotposts'&#41;.empty&#40;&#41;.html&#40;a&#41; //成功时输出神马 &#125; &#125;&#41;; return false &#125;; ajaxs&#40;&#41;; 3、在function.php文件里写入： function AjaxLoad&#40;&#41;&#123; &#160; if&#40; isset&#40;$_GET&#91;'action'&#93;&#41;&#41;&#123; if&#40;$_GET&#91;'action'&#93; == [...]]]></description>
			<content:encoded><![CDATA[<p>对于技术这种东西，始终觉得现在用的很多以后都是会被摒弃的，死抱着一棵救命稻草终究会被湮没在历史的洪流之中。所以，某些技术只是拿来用用就可以了，内在始终不想去了解，大体上能完成功能即可。比如jquery，几次想看看书里怎么写又觉得没什么用处，偶尔到图书馆看到中外这类的书籍若干，拿起来又放下。终究是自己兴趣所在才有动力完成下去啊~<span id="more-1299"></span></p>
<p>最近有俩同学问题我边栏种马回事……我沉思了若干秒，总结出目前用的这个叫jquery的ajax方式异步获取（自己随便写的名字 &#8211; -|）的玩意。原型忘记是什么了，记得是 <a href="http://winysky.com/" title="winy" target="_blank">winy</a> 那边的一个什么栗子……</p>
<p>首先我来举个栗子……栗子栗子栗子，每周都吃栗子。</p>
<p>1、首先要有加载jquery库；<br />
2、在自己要载入的js文件里写入：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family: Courier New,clearSys;"><span style="color: #003366; font-weight: bold;">function</span> ajaxs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
            url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://127.0.0.1/?action=ajax'</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">//域名换成你要用的</span>
            type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'get'</span><span style="color: #339933;">,</span>
            beforeSend<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #003366; font-weight: bold;">var</span> loading <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;span class=&quot;loadsidebar&quot;&gt;&lt;/span&gt;'</span><span style="color: #339933;">;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#hotposts'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>loading<span style="color: #009900;">&#41;</span>  <span style="color: #006600; font-style: italic;">//显示loading啊神马的</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#hotposts'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div style=&quot;text-align:center;padding-top:20px;&quot;&gt;还木有载好&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fast'</span><span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>   <span style="color: #006600; font-style: italic;">//错误时输出神马</span>
            success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#hotposts'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//成功时输出神马</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
ajaxs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>3、在function.php文件里写入：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">function</span> AjaxLoad<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'ajax'</span>  <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Oh shit'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//你可以根据需要输出，比如输出最新评论，最新文章，最新妹子什么的</span>
            <span style="color: #990000;">die</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #666666; font-style: italic;">//if($_GET['action'] == 'ajax'  ){</span>
            <span style="color: #666666; font-style: italic;">//如果理解的话，这样的代码还可以写出若干对吧？</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'AjaxLoad'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>顺利完成。</p>
<p>有了上面的模版，基本上要用到的功能都可以完成了，比如鼠标划过：<code>$('#xxx').hover(function() {....}</code>，比如点击某个地方：<code>$('#ooo').click(function() {...}</code>。把js部分中的最后一句话CP到这里面就完成鸟。具体见ink主题的边栏newcomments和Active Friends部分的效果。</p>
<p><a href="http://lh6.ggpht.com/-6znmN13emdQ/Trukeu_8GZI/AAAAAAAAAZE/BBHprl5q7XU/ajaxsideB.jpeg" title="ajax"><img class="picasa" src="http://lh6.ggpht.com/-6znmN13emdQ/Trukeu_8GZI/AAAAAAAAAZE/BBHprl5q7XU/s400/ajaxsideB.jpeg" alt="" /></a></p>
<p>很久没写过代码分享之类的东西了，面壁……</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="ajax获取WordPress边栏信息（一）" href="http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/">《ajax获取WordPress边栏信息（一）》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="ajax获取WordPress边栏信息（一）" href="http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/">http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/ajax_get_wordpress_sidebar/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>垃圾Trackback来势汹汹</title>
		<link>http://axiu.me/learning_notes/_spam_trackback_comes/</link>
		<comments>http://axiu.me/learning_notes/_spam_trackback_comes/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 14:09:38 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1281</guid>
		<description><![CDATA[有博客就有垃圾评论，这是不变的规律，除非你不和博友们交流或者禁止他们留言。我的博客用的防垃圾留言软件还是相对单一的，虽然是这样，一直以来偶尔有一两条漏网的sapm都可以很轻松的手动解决。但是最近出现了一个棘手的新状况：垃圾Trackbacks每日几十条剧增，删到手软，恰好最近也正心烦，没什么心思静下心来琢磨办法或者看代码，所以这个状况真的让我有点头疼了。 解决办法还是有的。 首先，可以挑出来频率比较高的几篇文章/页面，关闭它的Trackback，还有一种方法即关闭所有的Trackbacks。这个相对来说一劳永逸。 使用方法见下图： 使用语句： UPDATE wp_posts SET ping_status=&#8217;closed&#8217; WHERE post_status = &#8216;publish&#8217; AND post_type = &#8216;post&#8217;; UPDATE wp_posts SET ping_status=&#8217;closed&#8217; WHERE post_status = &#8216;publish&#8217; AND post_type = &#8216;page&#8217;; 另外遇到了一个问题，使用picasa桌面版本，总是无法登录，始终提示“没有为网络相册启用此账户”。起初以为是被墙了，经过一番折腾发现需要在在“工具”—“选项”—“电子邮件”选择：使用我的google账户，确定后：“文件”—“退出”（一定点击退出）。如此进行才可以正常使用。 怪事真多。 和本文无关的手办~~ &#187; 转载请注明来源：Axiu’s blog &#187; 《垃圾Trackback来势汹汹》&#187; 本文链接地址：http://axiu.me/learning_notes/_spam_trackback_comes/]]></description>
			<content:encoded><![CDATA[<p style="float:left"><img class="picasa" src="http://lh5.ggpht.com/-WDsEnNUXYf0/TrKdr_2zJ5I/AAAAAAAAAYo/xqo1nl_-Bys/s250/disabletrackbacks.png" alt="" /></p>
<p>有博客就有垃圾评论，这是不变的规律，除非你不和博友们交流或者禁止他们留言。我的博客用的防垃圾留言软件还是相对单一的，虽然是这样，一直以来偶尔有一两条漏网的sapm都可以很轻松的手动解决。但是最近出现了一个棘手的新状况：垃圾Trackbacks每日几十条剧增，删到手软，恰好最近也正心烦，没什么心思静下心来琢磨办法或者看代码，所以这个状况真的让我有点头疼了。<span id="more-1281"></span></p>
<p>解决办法还是有的。</p>
<p>首先，可以挑出来频率比较高的几篇文章/页面，关闭它的Trackback，还有一种方法即关闭所有的Trackbacks。这个相对来说一劳永逸。</p>
<p>使用方法见下图：</p>
<p><img class="picasa" src="http://lh4.ggpht.com/-QdVhVl7UHUk/TrKd81HygPI/AAAAAAAAAYw/ROLU2uNxzws/s512/sql.png" alt="" /></p>
<p>使用语句：</p>
<blockquote><p>UPDATE wp_posts SET ping_status=&#8217;closed&#8217; WHERE post_status = &#8216;publish&#8217; AND post_type = &#8216;post&#8217;;<br />
UPDATE wp_posts SET ping_status=&#8217;closed&#8217; WHERE post_status = &#8216;publish&#8217; AND post_type = &#8216;page&#8217;;</p></blockquote>
<p>另外遇到了一个问题，使用picasa桌面版本，总是无法登录，始终提示“没有为网络相册启用此账户”。起初以为是被墙了，经过一番折腾发现需要在在“工具”—“选项”—“电子邮件”选择：使用我的google账户，确定后：“文件”—“退出”（一定点击退出）。如此进行才可以正常使用。</p>
<p>怪事真多。</p>
<p><a href="http://lh6.ggpht.com/-knjulUvUL5Q/TqF9csTWEiI/AAAAAAAAAYI/GcauEqQcsVM/IMG_0551.JPG" title="手办"><img class="picasa" src="http://lh6.ggpht.com/-knjulUvUL5Q/TqF9csTWEiI/AAAAAAAAAYI/GcauEqQcsVM/s400/IMG_0551.JPG" alt="" /></a></p>
<p>和本文无关的手办~~</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="垃圾Trackback来势汹汹" href="http://axiu.me/learning_notes/_spam_trackback_comes/">《垃圾Trackback来势汹汹》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="垃圾Trackback来势汹汹" href="http://axiu.me/learning_notes/_spam_trackback_comes/">http://axiu.me/learning_notes/_spam_trackback_comes/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/_spam_trackback_comes/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>显示上一篇、下一篇的缩略图</title>
		<link>http://axiu.me/learning_notes/previous_and_next_post_with_thumbnails/</link>
		<comments>http://axiu.me/learning_notes/previous_and_next_post_with_thumbnails/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 16:58:11 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1199</guid>
		<description><![CDATA[在转悠论坛的时候，偶然碰到一个提问，希望单页文章的上一篇下一篇链接改成图片+链接的模样，就像大站的图片组那样~阿修当即表示这个可以有。获取文章缩略图神马的很容易，一条语句足矣，但是记得每篇文章的上一篇下一篇貌似就不那么简单了。 经过一番折腾，基本方法算是出炉了。由于get_the_post_thumbnail可以获取文章ID对应的缩略图，所以可以以此为契机，自己找到上一篇和下一篇的ID，然后获取之即可。下面是给出的解决方案。主要用到的函数是get_adjacent_post，这个函数不是特别常见，用法是这样的 get_adjacent_post( $in_same_cat, $excluded_categories, $previous ) $in_same_cat (boolean) (optional) 文章是不是在相同分类下. Default: false $excluded_categories (string) (optional) 需要排除的分类ID. Default: ” $previous (boolean) (optional) 是否显示上一篇（取false的话就是下一篇）. Default: true 上一篇缩略图 &#60;?php $previousPost=get_adjacent_post&#40;false, '', true&#41;; if &#40;$previousPost&#41; &#123; echo get_the_post_thumbnail&#40;$previousPost-&#62;ID, 'thumbnail'&#41;; &#125; ?&#62; 下一篇缩略图 &#60;?php $nextPost=get_adjacent_post&#40;false, '', false&#41;; if &#40;$nextPost&#41; &#123; echo get_the_post_thumbnail&#40;$nextPost-&#62;ID, 'thumbnail'&#41;; &#125; ?&#62; 当然，如果加标题和链接的话，直接放echo里面就可以了。比如可以这么写： echo &#34;&#60;a href='&#34;.get_permalink&#40;$previousPost-&#62;ID&#41;.&#34;' [...]]]></description>
			<content:encoded><![CDATA[<p>在转悠论坛的时候，偶然碰到一个提问，希望单页文章的上一篇下一篇链接改成图片+链接的模样，就像大站的图片组那样~阿修当即表示这个可以有。获取文章缩略图神马的很容易，一条语句足矣，但是记得每篇文章的上一篇下一篇貌似就不那么简单了。</p>
<p>经过一番折腾，基本方法算是出炉了。由于get_the_post_thumbnail可以获取文章ID对应的缩略图，所以可以以此为契机，<span id="more-1199"></span>自己找到上一篇和下一篇的ID，然后获取之即可。下面是给出的解决方案。主要用到的函数是get_adjacent_post，这个函数不是特别常见，用法是这样的</p>
<blockquote><p><strong>get_adjacent_post( $in_same_cat, $excluded_categories, $previous )</strong></p>
<p>$in_same_cat<br />
(boolean) (optional) 文章是不是在相同分类下.<br />
Default: false</p>
<p>$excluded_categories<br />
(string) (optional) 需要排除的分类ID.<br />
Default: ”</p>
<p>$previous<br />
(boolean) (optional) 是否显示上一篇（取false的话就是下一篇）.<br />
Default: true</p></blockquote>
<p>上一篇缩略图</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$previousPost</span><span style="color: #339933;">=</span>get_adjacent_post<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</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;">$previousPost</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> get_the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$previousPost</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thumbnail'</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></div></div>

<p>下一篇缩略图</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$nextPost</span><span style="color: #339933;">=</span>get_adjacent_post<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</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>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$nextPost</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">echo</span> get_the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nextPost</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thumbnail'</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></div></div>

<p>当然，如果加标题和链接的话，直接放echo里面就可以了。比如可以这么写：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;a href='&quot;</span><span style="color: #339933;">.</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$previousPost</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' title='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$previousPost</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' &gt;&quot;</span><span style="color: #339933;">.</span>get_the_post_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$previousPost</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thumbnail'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>当然，前提是你的文章设置了缩略图……</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="显示上一篇、下一篇的缩略图" href="http://axiu.me/learning_notes/previous_and_next_post_with_thumbnails/">《显示上一篇、下一篇的缩略图》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="显示上一篇、下一篇的缩略图" href="http://axiu.me/learning_notes/previous_and_next_post_with_thumbnails/">http://axiu.me/learning_notes/previous_and_next_post_with_thumbnails/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/previous_and_next_post_with_thumbnails/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>带图片的相关文章代码</title>
		<link>http://axiu.me/learning_notes/related_posts_with_images/</link>
		<comments>http://axiu.me/learning_notes/related_posts_with_images/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 01:25:53 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1193</guid>
		<description><![CDATA[相关文章的调用方法很多，可以直接上插件，也可以从其他博主那里找来代码修改之后贴上。我目前用的也是自己修改的代码，主要内容来自 willin 的相关文章，经过了 zww 大叔修正。不知道其中过程是怎样，对于懒得深究代码运行过程的我来说，改了改输出，看一下能用就行了。最近有几位朋友说希望分享出来，就拿出来共享一下了。 php部分（写在single.php或者其他需要的地方） &#60;ul class=&#34;relatedposts&#34;&#62; &#60;?php $post_num = 5; // 數量設定. $exclude_id = $post-&#62;ID; // 單獨使用要開此行 //zww: edit $posttags = get_the_tags&#40;&#41;; $i = 0; if &#40; $posttags &#41; &#123; $tags = ''; foreach &#40; $posttags as $tag &#41; $tags .= $tag-&#62;term_id . ','; //zww: edit $args = array&#40; 'post_status' =&#62; 'publish', 'tag__in' [...]]]></description>
			<content:encoded><![CDATA[<p>相关文章的调用方法很多，可以直接上插件，也可以从其他博主那里找来代码修改之后贴上。我目前用的也是自己修改的代码，主要内容来自 <a href="http://kan.willin.org/" target="_blank">willin</a> 的相关文章，经过了 <a href="http://zww.me" target="_blank">zww</a> 大叔修正。不知道其中过程是怎样，对于懒得深究代码运行过程的我来说，改了改输出，看一下能用就行了。最近有几位朋友说希望分享出来，就拿出来共享一下了。<span id="more-1193"></span></p>
<p style="text-align:center"><a href="http://lh4.ggpht.com/-PvnwI9ncepw/TksZm1LJpMI/AAAAAAAAAVk/yciautIOLQ8/relatedposts.jpg" title="相关文章"><img class="picasa" src="http://lh4.ggpht.com/-PvnwI9ncepw/TksZm1LJpMI/AAAAAAAAAVk/yciautIOLQ8/s400/relatedposts.jpg" alt="" /></a></p>
<p>php部分（写在single.php或者其他需要的地方）</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;">&lt;ul class=&quot;relatedposts&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$post_num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 數量設定.</span>
<span style="color: #000088;">$exclude_id</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: #666666; font-style: italic;">// 單獨使用要開此行 //zww: edit</span>
<span style="color: #000088;">$posttags</span> <span style="color: #339933;">=</span> get_the_tags<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$posttags</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$posttags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$tags</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">term_id</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//zww: edit</span>
	<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'post_status'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'publish'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'tag__in'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// 只選 tags 的文章. //zww: edit</span>
		<span style="color: #0000ff;">'post__not_in'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$exclude_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// 排除已出現過的文章.</span>
		<span style="color: #0000ff;">'ignore_sticky_posts'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'comment_date'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// 依評論日期排序.</span>
		<span style="color: #0000ff;">'posts_per_page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$post_num</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	query_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #009900;">&#123;</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>
			<span style="color: #000000; font-weight: bold;">&lt;?php</span>	<span style="color: #000088;">$soContent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//axiu: 获取文章第一个图片</span>
				<span style="color: #000088;">$soImages</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'~&lt;img [^\&gt;]*\ /&gt;~'</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$soImages</span><span style="color: #339933;">,</span> <span style="color: #000088;">$soContent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$thePics</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$allPics</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thePics</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</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;">$allPics</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot; rel=&quot;nofollow&quot;&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$thePics</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">.</span>the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</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: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'template_url'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/default.jpg&quot; alt=&quot;'</span><span style="color: #339933;">.</span>get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">.</span>the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>
		<span style="color: #000088;">$exclude_id</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">','</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: #000088;">$i</span> <span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span> wp_reset_query<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;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$post_num</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// 當 tags 文章數量不足, 再取 category 補足.</span>
	<span style="color: #000088;">$cats</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> get_the_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cat</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$cats</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_ID</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'category__in'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cats</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// 只選 category 的文章.</span>
		<span style="color: #0000ff;">'post__not_in'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$exclude_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'ignore_sticky_posts'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'comment_date'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'posts_per_page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$post_num</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$i</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	query_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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: #009900;">&#123;</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>
			<span style="color: #000000; font-weight: bold;">&lt;?php</span>	<span style="color: #000088;">$soContent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//axiu: 获取文章第一个图片</span>
				<span style="color: #000088;">$soImages</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'~&lt;img [^\&gt;]*\ /&gt;~'</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$soImages</span><span style="color: #339933;">,</span> <span style="color: #000088;">$soContent</span><span style="color: #339933;">,</span> <span style="color: #000088;">$thePics</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$allPics</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thePics</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</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;">$allPics</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot; rel=&quot;nofollow&quot;&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$thePics</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;.'</span><span style="color: #339933;">.</span>the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</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: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'template_url'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/images/default.jpg&quot; alt=&quot;'</span><span style="color: #339933;">.</span>get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">.</span>the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span> wp_reset_query<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;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span>  <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;没有相关文章!&lt;/li&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/ul&gt;</pre></div></div>

<p>写完就剩下css定义了（参照无觅插件的显示效果制作），奉上我自己目前（截至本文发稿未知）用的</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family: Courier New,clearSys;">.relatedposts<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">600px</span><span style="color: #00AA00;">;</span>
	_width<span style="color: #00AA00;">:</span><span style="color: #933;">280px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.relatedposts</span> a<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span><span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span>/<span style="color: #933;">15px</span> arial<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.relatedposts</span> li<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">98px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">130px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span> <span style="color: #933;">5px</span> <span style="color: #933;">9px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fefefe</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#dfdfdf</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.relatedposts</span> li<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#f3f3f3</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.relatedposts</span> li<span style="color: #3333ff;">:hover </span>a<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#333</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.relatedposts</span> img<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">96px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>PS：关于默认图片（我用的是麻美妹子的图）：新建一个default.jpg，然后放在主题的images文件夹下就可以了。</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="带图片的相关文章代码" href="http://axiu.me/learning_notes/related_posts_with_images/">《带图片的相关文章代码》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="带图片的相关文章代码" href="http://axiu.me/learning_notes/related_posts_with_images/">http://axiu.me/learning_notes/related_posts_with_images/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/related_posts_with_images/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>ink主题的小手术</title>
		<link>http://axiu.me/learning_notes/ink_adjustment/</link>
		<comments>http://axiu.me/learning_notes/ink_adjustment/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 02:02:59 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress主题]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1189</guid>
		<description><![CDATA[本来我应该老老实实善待刚刚出炉的MxS2的，但是激情还是完全在目前这个主题上啊！假期不忙，闲的没事整天玩玩闹闹吃吃喝喝。但是偶尔也得练习一下指力，不然木有未来了。还有，ink是目前这主题的名字。 1、边栏 前两天天折腾了一下边栏，现在看来丰富了一些。主要加了一个tab切换的小框框。我能想到的只有最近评论和热文，另外那个最新文章完全是放上去凑数的……幸好加了ajax，要不然加载会慢许多吧。还有，这个jquery的切换框的高度弄得我实在是无奈啊= =。 还有一个是除了首页以外的页面显示的，活跃朋友神马的，比如，拿鼠标指针戳小邪的头像会出来一个框框，里面放着他最近的发言~~还有次数什么的，其他可以戳戳看。 2、显示 由于主题比较宽（差不多1000px），加上边上划出来的小书签，1024分辨率（包括以下）的屏幕基本被塞满，所以用了些小工具，根据分辨率获取不同的css文件，让1024的朋友们看到不同的页面（边栏下沉）。刚刚完成，欢迎把分辨率调低进行测试~~ 天气大好，不冷不热，正是happy的好时候，抓紧假期这最后的时间吧。 &#187; 转载请注明来源：Axiu’s blog &#187; 《ink主题的小手术》&#187; 本文链接地址：http://axiu.me/learning_notes/ink_adjustment/]]></description>
			<content:encoded><![CDATA[<p>本来我应该老老实实善待刚刚出炉的MxS2的，但是激情还是完全在目前这个主题上啊！假期不忙，闲的没事整天玩玩闹闹吃吃喝喝。但是偶尔也得练习一下指力，不然木有未来了。还有，ink是目前这主题的名字。</p>
<h3>1、边栏</h3>
<p>前两天天折腾了一下边栏，现在看来丰富了一些。主要加了一个tab切换的小框框。我能想到的只有最近评论和热文，另外那个最新文章完全是放上去凑数的……幸好加了ajax，要不然加载会慢许多吧。还有，这个jquery的切换框的高度弄得我实在是无奈啊= =。<span id="more-1189"></span></p>
<p>还有一个是除了首页以外的页面显示的，活跃朋友神马的，比如，拿鼠标指针戳小邪的头像会出来一个框框，里面放着他最近的发言~~还有次数什么的，其他可以戳戳看。</p>
<h3>2、显示</h3>
<p>由于主题比较宽（差不多1000px），加上边上划出来的小书签，1024分辨率（包括以下）的屏幕基本被塞满，所以用了些小工具，根据分辨率获取不同的css文件，让1024的朋友们看到不同的页面（边栏下沉）。刚刚完成，欢迎把分辨率调低进行测试~~</p>
<p>天气大好，不冷不热，正是happy的好时候，抓紧假期这最后的时间吧。</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="ink主题的小手术" href="http://axiu.me/learning_notes/ink_adjustment/">《ink主题的小手术》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="ink主题的小手术" href="http://axiu.me/learning_notes/ink_adjustment/">http://axiu.me/learning_notes/ink_adjustment/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/ink_adjustment/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
		</item>
		<item>
		<title>给“继续阅读”添加不同颜色</title>
		<link>http://axiu.me/learning_notes/change_colors_of_readmore/</link>
		<comments>http://axiu.me/learning_notes/change_colors_of_readmore/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 03:41:53 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1165</guid>
		<description><![CDATA[作为个人博客，想把首页做的像商业网站那样出彩是比较有难度的，加上内容不够丰富，很容易就会有单调或许久没更新的感觉。记得在上个主题的时候，给“继续阅读”加上了一些不一样的颜色，看起来还不错，偷懒挖出来分享一下。只是无聊的偷懒做法，有需要的可以酌情CP。 围观地址：【demo】 1、打开index.php，找到 while(have_posts())... 这一行，在之前添加计数器 $display = 1;；接着找到 endwhile...，在这行之前加入自增 $display ++;。 2、接着给more-read这个链接添加背景，找到more-read的]]></description>
			<content:encoded><![CDATA[<p>作为个人博客，想把首页做的像商业网站那样出彩是比较有难度的，加上内容不够丰富，很容易就会有单调或许久没更新的感觉。记得在上个主题的时候，给“继续阅读”加上了一些不一样的颜色，看起来还不错，偷懒挖出来分享一下。只是无聊的偷懒做法，有需要的可以酌情CP。<span id="more-1165"></span></p>
<p>围观地址：【<a href="http://demo.axiu.me/?preview_theme=Lift" title="demo" target="_blank">demo</a>】</p>
<p>1、打开index.php，找到<code> while(have_posts())... </code>这一行，在之前添加计数器<code> $display = 1;</code>；接着找到<code> endwhile...</code>，在这行之前加入自增<code> $display ++;</code>。</p>
<p>2、接着给more-read这个链接添加背景，找到more-read的<a...，在里面加入<br />
<code>style=”background:<?php get_color($display); ?>“</code></p>
<p>之后打开function.php（直接往里写也可以），在合适的地方写入函数</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family: Courier New,clearSys;"><span style="color: #666666; font-style: italic;">//more-link color</span>
<span style="color: #000000; font-weight: bold;">function</span> get_color<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</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;">$num</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'#F06434'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">4</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'#6E8033'</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: #b1b100;">echo</span> <span style="color: #0000ff;">'#710300'</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>结束，实际效果【<a href="http://demo.axiu.me/?preview_theme=Lift" title="demo" target="_blank">demo</a>】。</p>
<p>这里只是拿“继续阅读”举个栗子，但是因为我把read-more链接另外写出来，而不是在content()里默认的，所以可能你的主题无法找到read more的链接。但是其他地方，比如标题、文章条目、评论条目等等地方都可以使用。类似的样式还可以做很多，比如换背景图片、进行文字大小变化、边距长宽高神马的，就看自己的需要了。</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="给“继续阅读”添加不同颜色" href="http://axiu.me/learning_notes/change_colors_of_readmore/">《给“继续阅读”添加不同颜色》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="给“继续阅读”添加不同颜色" href="http://axiu.me/learning_notes/change_colors_of_readmore/">http://axiu.me/learning_notes/change_colors_of_readmore/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/change_colors_of_readmore/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>WP错误：Fatal error-Call to undefined function wp()</title>
		<link>http://axiu.me/learning_notes/function_wp_error/</link>
		<comments>http://axiu.me/learning_notes/function_wp_error/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 00:40:04 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[WP札记]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1152</guid>
		<description><![CDATA[一大早起来打开博客，希望进入后台整理整理，不料出现一行熟悉又陌生的小字。熟悉是因为这必定是错误提示，陌生是因为从来没见过，内容是这样"Fatal error: Call to undefined function: wp()"，而打开后台错误是这个"Fatal error: Call to undefined function get_option() "。肿么回事肿么回事，昨天晚上还好好的。我郁闷，我使劲捋头发，我咬牙切齿。 本着非格物致知，只要解决办法，不要详细解释之糊弄精神。我启动了伟大的搜索引擎，虽然满脸是外文，不过基本看懂了，需要重新设置wp-config，去空间文件管理，果然看到wp-config.php是0kb，犹豫了一下，删除之。 之后再进入首页，基本要做的就是重新输入数据库名称，用户神马的。这个如果成功安装过都应该有体会的。竟然就这么解决了 &#187; 转载请注明来源：Axiu’s blog &#187; 《WP错误：Fatal error-Call to undefined function wp()》&#187; 本文链接地址：http://axiu.me/learning_notes/function_wp_error/]]></description>
			<content:encoded><![CDATA[<p>一大早起来打开博客，希望进入后台整理整理，不料出现一行熟悉又陌生的小字。熟悉是因为这必定是错误提示，陌生是因为从来没见过，内容是这样<code>"Fatal error: Call to undefined function: wp()"</code>，而打开后台错误是这个<code>"Fatal error: Call to undefined function get_option() "</code>。肿么回事肿么回事，昨天晚上还好好的。我郁闷，我使劲捋头发，我咬牙切齿。<span id="more-1152"></span></p>
<p>本着非格物致知，只要解决办法，不要详细解释之糊弄精神。我启动了伟大的搜索引擎，虽然满脸是外文，不过基本看懂了，需要重新设置wp-config，去空间文件管理，果然看到wp-config.php是0kb，犹豫了一下，删除之。</p>
<p>之后再进入首页，基本要做的就是重新输入数据库名称，用户神马的。这个如果成功安装过都应该有体会的。竟然就这么解决了</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="WP错误：Fatal error-Call to undefined function wp()" href="http://axiu.me/learning_notes/function_wp_error/">《WP错误：Fatal error-Call to undefined function wp()》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="WP错误：Fatal error-Call to undefined function wp()" href="http://axiu.me/learning_notes/function_wp_error/">http://axiu.me/learning_notes/function_wp_error/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/learning_notes/function_wp_error/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>关于background-position的问题</title>
		<link>http://axiu.me/documentation/background_position/</link>
		<comments>http://axiu.me/documentation/background_position/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 09:32:13 +0000</pubDate>
		<dc:creator>axiu</dc:creator>
				<category><![CDATA[技术文档]]></category>
		<category><![CDATA[WP技巧]]></category>

		<guid isPermaLink="false">http://axiu.me/?p=1128</guid>
		<description><![CDATA[每次做主题都有特别的发现，对于我这样喜钻研愛探索的好同学来说，这是很欣喜的一件事。昨夜永哥说目前的主题在360浏览器下有问题，我惯性的以为是不死的IE6在作怪，所以没怎么放在心上。今天上午用IEtester打开首页和内页，果然出现很多错误提示，还有各种布局的悲惨效果。遂决定改改。 基本内容分为js和css两个部分。 首先是js报错，奇怪只是IE下报错。我找了一下，首先发现的错误是因为在某个｛&#8230;｝内的结尾处写了一个逗号，这是不允许的，疏忽。 接下来是另外一个，这个就比较奇怪了：xx is null or not anobject。本地查找折腾了半天，发现是一句css提取的错误。在边栏的categories那里，我用js控制的背景滑动。当然得首先提取css的background-position，就是这个属性，让我费了老大劲。 1、chrome和safari下，background-position/background-position-x(y)啥都支持； 2、firefox、opera不支持background-Position-x/y，但是支持background-position； 3、IE支持background-Position-x/y,也支持background-position。 所以这里的思路就只能是：提取background-position，然后调用。 但是，一旦往里这么写：pos = $(this).css('background-position'); IE下立刻就会报错“x行x列，xx is null or not an object”。alert返回的值也是“undefined”。网上的老外们有的说传值进去再传回来，有的让升级js库，有的直接让升级浏览器，MD能升级还要你干啥。 解决办法：改成css('backgroundPosition')。具体原因，没有系统学习过，不解答。 css部分，主要修改了一下评论的reply部分，和首页的“躲猫猫”部分的圆角。嗯，还有记录访客信息，头像神马的，荒淫测试反馈。 感想：IE虽然常常落后很多，但是某些时候，正式考验我们代码写的是否严谨，比如css里许多不合规范的写法，在其他浏览器都可以正常显示，但是IE会错乱，我们一直在骂IE不死，但是如果是小型代码量，稍微规整一下，IE下也不是那么惨不忍睹的。 当然，IE6除外。 &#187; 转载请注明来源：Axiu’s blog &#187; 《关于background-position的问题》&#187; 本文链接地址：http://axiu.me/documentation/background_position/]]></description>
			<content:encoded><![CDATA[<p>每次做主题都有特别的发现，对于我这样喜钻研愛探索的好同学来说，这是很欣喜的一件事。昨夜永哥说<a title="假期和新主题" href="http://axiu.me/sentiment/new_day_new_theme/" target="_blank">目前的主题</a>在360浏览器下有问题，我惯性的以为是不死的IE6在作怪，所以没怎么放在心上。今天上午用IEtester打开首页和内页，果然出现很多错误提示，还有各种布局的悲惨效果。遂决定改改。</p>
<p>基本内容分为js和css两个部分。</p>
<p>首先是js报错，奇怪只是IE下报错。我找了一下，首先发现的错误是因为在某个｛&#8230;｝内的结尾处写了一个逗号，这是不允许的，疏忽。<span id="more-1128"></span></p>
<p>接下来是另外一个，这个就比较奇怪了：xx is null or not anobject。本地查找折腾了半天，发现是一句css提取的错误。在边栏的categories那里，我用js控制的背景滑动。当然得首先提取css的background-position，就是这个属性，让我费了老大劲。</p>
<blockquote><p>1、chrome和safari下，background-position/background-position-x(y)啥都支持；<br />
2、firefox、opera不支持background-Position-x/y，但是支持background-position；<br />
3、IE支持background-Position-x/y,也支持background-position。</p></blockquote>
<p>所以这里的思路就只能是：提取background-position，然后调用。</p>
<p>但是，一旦往里这么写：<code>pos = $(this).css('background-position');</code><br />
IE下立刻就会报错“<strong>x行x列，xx is null or not an object</strong>”。alert返回的值也是“<strong>undefined</strong>”。网上的老外们有的说传值进去再传回来，有的让升级js库，有的直接让升级浏览器，MD能升级还要你干啥。<br />
解决办法：改成<code>css('backgroundPosition')</code>。具体原因，没有系统学习过，不解答。</p>
<p>css部分，主要修改了一下评论的reply部分，和首页的“躲猫猫”部分的圆角。嗯，还有记录访客信息，头像神马的，荒淫测试反馈。</p>
<div class="g_adsense">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-1851998914253091";
/* 单页文章 */
google_ad_slot = "4510400700";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<p>感想：IE虽然常常落后很多，但是某些时候，正式考验我们代码写的是否严谨，比如css里许多不合规范的写法，在其他浏览器都可以正常显示，但是IE会错乱，我们一直在骂IE不死，但是如果是小型代码量，稍微规整一下，IE下也不是那么惨不忍睹的。</p>
<p>当然，IE6除外。</p>
<div class="postinfo">&raquo; 转载请注明来源：Axiu’s blog &raquo; <a rel="bookmark" title="关于background-position的问题" href="http://axiu.me/documentation/background_position/">《关于background-position的问题》</a><br/>&raquo; 本文链接地址：<a rel="bookmark" title="关于background-position的问题" href="http://axiu.me/documentation/background_position/">http://axiu.me/documentation/background_position/</a></div>]]></content:encoded>
			<wfw:commentRss>http://axiu.me/documentation/background_position/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
	</channel>
</rss>

