15年前 (2009-10-27)  网站建设 |   抢沙发  15 
文章评分 0 次,平均分 0.0

安装步骤

  首先从WP-PageNavi的网站上下载插件代码:http://lesterchan.net/wordpress/readme/wp-pagenavi.html

  然后解压,将 pagenavi 文件夹上传到/wp-content/plugins中,之后在后台激活WP-PageNavi插件就可以了。

插件配置

  打开/wp-content/themes/你的风格目录/index.php,找到:

 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;div</span> <span style="margin: 0px; color: #000066; padding: 0px;">class</span>=<span style="margin: 0px; color: #ff0000; padding: 0px;">"postnav"</span><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span>
  <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;div</span> <span style="margin: 0px; color: #000066; padding: 0px;">class</span>=<span style="margin: 0px; color: #ff0000; padding: 0px;">"prev"</span><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;</span>?php next_posts_link<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span>__<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span><span style="margin: 0px; color: #ff0000; padding: 0px;">'? Previous Entries'</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span> ?<span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span>
 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;/div&gt;</span></span> <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;div</span> <span style="margin: 0px; color: #000066; padding: 0px;">class</span>=<span style="margin: 0px; color: #ff0000; padding: 0px;">"next"</span><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;</span>?php previous_posts_link<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span>__<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span><span style="margin: 0px; color: #ff0000; padding: 0px;">'Next Entries ?'</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span> ?<span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;/div&gt;</span></span> <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;/div&gt;</span></span>

  

替换为:

 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;div</span> <span style="margin: 0px; color: #000066; padding: 0px;">class</span>=<span style="margin: 0px; color: #ff0000; padding: 0px;">"postnav"</span><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span>
 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;</span>?php if<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span>function_exists<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span><span style="margin: 0px; color: #ff0000; padding: 0px;">'wp_pagenavi'</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span><span style="margin: 0px; color: #66cc66; padding: 0px;">{</span> wp_pagenavi<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span>; <span style="margin: 0px; color: #66cc66; padding: 0px;">}</span> else <span style="margin: 0px; color: #66cc66; padding: 0px;">{</span> ?<span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span>
 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;div</span> <span style="margin: 0px; color: #000066; padding: 0px;">class</span>=<span style="margin: 0px; color: #ff0000; padding: 0px;">"prev"</span><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;</span>?php next_posts_link<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span>__<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span><span style="margin: 0px; color: #ff0000; padding: 0px;">'? Previous Entries'</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span> ?<span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;/div&gt;</span></span>
 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;div</span> <span style="margin: 0px; color: #000066; padding: 0px;">class</span>=<span style="margin: 0px; color: #ff0000; padding: 0px;">"next"</span><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;</span>?php previous_posts_link<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span>__<span style="margin: 0px; color: #66cc66; padding: 0px;">(</span><span style="margin: 0px; color: #ff0000; padding: 0px;">'Next Entries ?'</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span><span style="margin: 0px; color: #66cc66; padding: 0px;">)</span> ?<span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span><span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;/div&gt;</span></span> <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;</span>?php <span style="margin: 0px; color: #66cc66; padding: 0px;">}</span> ?<span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&gt;</span></span>
 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;/div&gt;</span></span>

?

??? 如果你的模板找不到原始的分页代码,就直接添加吧!

?

 <span style="margin: 0px; color: #009900; padding: 0px;"><span style="font-weight: bold; margin: 0px; color: #000000; padding: 0px;">&lt;!------------------------WP-PageNavi 分页开始-------------------------------&gt;
&lt;div&gt;
&lt;?php if(function_exists('wp_pagenavi')){ wp_pagenavi(); } else { ?&gt;
&lt;div&gt;&lt;?php next_posts_link(__('? Previous Entries')) ?&gt;&lt;/div&gt;
&lt;div&gt;&lt;?php previous_posts_link(__('Next Entries ?')) ?&gt;&lt;/div&gt; &lt;?php } ?&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;!------------------------WP-PageNavi 分页结束-------------------------------&gt;
&lt;?php get_sidebar(); ?&gt;
&lt;div&gt;&lt;/div&gt;&lt;!-- 我是空--&gt; 
&lt;?php get_footer(); ?&gt;</span></span>

?

解释一下:

<?php get_sidebar(); ?>? 侧边栏

<?php get_footer(); ?>??? 底部栏

?

在这上面写上分页代码即可

 

除特别注明外,本站所有文章均为牵挂的家原创,转载请注明出处来自http://qinai.net/10.html

发表评论

表情 格式

暂无评论

登录

忘记密码 ?

切换登录

注册

扫一扫二维码分享