{"id":1413,"date":"2010-12-27T15:27:07","date_gmt":"2010-12-27T15:27:07","guid":{"rendered":"http:\/\/chan.nds.hk\/blog\/?p=1413"},"modified":"2010-12-27T15:27:07","modified_gmt":"2010-12-27T15:27:07","slug":"wordpress-%e2%80%93-%e4%b8%8d%e7%94%a8%e6%8f%92%e4%bb%b6%e5%8a%a0%e5%85%a5%e6%96%87%e7%ab%a0%e5%88%86%e9%a0%81","status":"publish","type":"post","link":"https:\/\/chan.nds.hk\/blog\/?p=1413","title":{"rendered":"WordPress \u2013 \u4e0d\u7528\u63d2\u4ef6\u52a0\u5165\u6587\u7ae0\u5206\u9801"},"content":{"rendered":"<p><span style=\"font-size:14px;\">\u770b\u5230\u4e00\u500b\u4e0d\u7528\u5b89\u88dd\u63d2\u4ef6pagenavi\u7684\u8a71\uff0c\u5c31\u53ef\u4ee5\u505a\u5230\u6587\u7ae0\u5206\u9801\u529f\u80fd\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u5be6\u5728\u5f37\u5927\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u662f\u53f0\u7063\u5927\u5e2b\u4fee\u6539\u7684code\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u9996\u5148\u6253\u958btheme\u5165\u9762\u7684function.php\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u5982\u679c\u7528twenty ten\u7684\u8a71\uff0c\u5728endif \u524d\u9762 \u52a0\u5165\u5982\u4e0b\u4ee3\u78bc:<!--more--><\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\/* Mini Pagenavi v1.0 by Willin Kan. Edit by zwwooooo *\/<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( !function_exists(&#39;pagenavi&#39;) ) {<\/span><\/p>\n<p><span style=\"font-size:14px;\">function pagenavi( $p = 5 ) { \/\/ \u53d6\u7576\u524d\u9801\u524d\u5f8c\u5404 2 \u9801<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( is_singular() ) return; \/\/ \u6587\u7ae0\u8207\u63d2\u9801\u4e0d\u7528<\/span><\/p>\n<p><span style=\"font-size:14px;\">global $wp_query, $paged;<\/span><\/p>\n<p><span style=\"font-size:14px;\">$max_page = $wp_query-&gt;max_num_pages;<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $max_page == 1 ) return; \/\/ \u53ea\u6709\u4e00\u9801\u4e0d\u7528<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( empty( $paged ) ) $paged = 1;<\/span><\/p>\n<p><span style=\"font-size:14px;\">echo &#39;Page: &#39; . $paged . &#39; of &#39; . $max_page . &#39; &nbsp;&#39;; \/\/ \u986f\u793a\u9801\u6578<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $paged &gt; 1 ) p_link( $paged - 1, &#39;\u4e0a\u4e00\u9801&#39;, &#39;? Previous&#39; );\/* \u5982\u679c\u7576\u524d\u9801\u5927\u65bc1\u5c31\u986f\u793a\u4e0a\u4e00\u9801\u93c8\u63a5 *\/<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $paged &gt; $p + 1 ) p_link( 1, &#39;\u6700\u524d\u9801&#39; );<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $paged &gt; $p + 2 ) echo &#39;... &#39;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">for( $i = $paged - $p; $i &lt;= $paged + $p; $i++ ) { \/\/ \u4e2d\u9593\u9801<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $i &gt; 0 &amp;&amp; $i &lt;= $max_page ) $i == $paged ? print &quot;{$i} &quot; : p_link( $i );<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $paged &lt; $max_page - $p - 1 ) echo &#39;... &#39;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $paged &lt; $max_page - $p ) p_link( $max_page, &#39;\u6700\u5f8c\u9801&#39; );<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $paged &lt; $max_page ) p_link( $paged + 1,&#39;\u4e0b\u4e00\u9801&#39;, &#39;Next ?&#39; );\/* \u5982\u679c\u7576\u524d\u9801\u4e0d\u662f\u6700\u5f8c\u4e00\u9801\u986f\u793a\u4e0b\u4e00\u9801\u93c8\u63a5 *\/<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">function p_link( $i, $title = &#39;&#39;, $linktype = &#39;&#39; ) {<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $title == &#39;&#39; ) $title = &quot;\u7b2c {$i} \u9801&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">if ( $linktype == &#39;&#39; ) { $linktext = $i; } else { $linktext = $linktype; }<\/span><\/p>\n<p><span style=\"font-size:14px;\">echo &quot;{$linktext} &quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">\/\/ -- END<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u4e4b\u5f8c\u5462\uff0c\u5728\u9700\u8981\u4f7f\u7528\u5230\u9019\u7ffb\u9801\u529f\u80fd\u7684\u5730\u65b9\u52a0\u5165\u5982\u4e0b\u4ee3\u78bc:<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;div class=&quot;pagenavi&quot;&gt;&lt;?php if (function_exists(&#39;pagenavi&#39;)); ?&gt;&lt;?php pagenavi(); ?&gt;&lt;\/div&gt;<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u4e00\u822c\u9700\u8981\u7528\u5230\u7ffb\u9801\u5c0e\u822a\u7684\u5730\u65b9\u662f\u9996\u9801index.php\uff0c\u6587\u7ae0\u6b78\u6a94\u9801archive.php\uff0c\u6a19\u7c64\u9801tag.php, &nbsp;\u5206\u985e\u76ee\u9304\u9801category.php\u7b49\u6a94\u6848\uff0c\u4ee5\u6211\u4f7f\u7528\u7684Wordpress\u9810\u8a2d\u4e3b\u984cTwenty Ten\u70ba\u4f8b\uff0c\u6253\u958b\u9019\u4e9b\u6a94\u6848\u5f8c\uff0c\u90fd\u5c07\u4ee3\u78bc\u653e\u5728&lt;div id=&rdquo;content&rdquo; role=&rdquo;main&rdquo;&gt;\u2027\u2027\u2027 \u2027\u2027\u2027&lt;\/div&gt;&lt;! &nbsp; #content &nbsp; &gt;\u9019\u5c0d&lt;div&gt;\u4e4b\u9593\u7684\u6700\u5e95\u90e8\uff0c\u4e5f\u5c31\u662f\u653e\u5728&lt;\/div&gt;&lt;! &nbsp; #content &nbsp; &gt;\u4e4b\u524d\u3002\u539f\u4f86\u7684&ldquo;\u8f03\u65b0\u7684\u6587\u7ae0&rdquo;\u548c&ldquo;\u8f03\u820a\u7684\u6587\u7ae0&rdquo;\u9019\u5169\u53e5\u5c31\u4e0d\u8981\u4e86\uff0c\u627e\u5230\u4e3b\u984c\u4e2d\u7684loop.php\u6a94\u6848, \u5c07\u88e1\u9762\u7684&lt;div id=&rdquo;nav-below&rdquo; class=&rdquo;navigation&rdquo;&gt;\u548c&lt;\/div&gt;&lt;! &nbsp; #nav-below &nbsp; &gt;\u4e4b\u9593\u7684\u5167\u5bb9\u522a\u6389\u5373\u53ef\uff0c\u5176\u5b83\u4e3b\u984c\u61c9\u8a72\u8996\u60c5\u6cc1\u800c\u5b9a\u4e86\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u4e4b\u5f8c\u53ef\u4ee5\u70ba\u6587\u7ae0\u5206\u9801\u5c0e\u822a\u5217\u505a\u4e00\u4e0bcss\u5316\uff0c\u7576\u7136\u662f\u653e\u5165style.css\u5566\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">#pagenavi{margin:5px 10px;}.page-numbers{line-height:16px;margin:0;padding:1px 2px;text-decoration:none;border:2px solid #E6F7FF;color:#c60;}.page-numbers:hover{background:#777e77; color:#bbc0bb;}.current, .current:hover{color:#650;background:#E7F6FB;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u6709\u8208\u81f4\u7684\u53ef\u4ee5\u81ea\u5df1\u4fee\u6539\u4e00\u4e0b\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u53c3\u8003:&nbsp;<a href=\"http:\/\/www.eyingworld.com\/wordpress-navigation-without-plugin.html\">http:\/\/www.eyingworld.com\/wordpress-navigation-without-plugin.html<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/chan.nds.hk\/blog\/?p=1413\"><img width=\"150\" height=\"150\" src=\"https:\/\/chan.nds.hk\/blog\/wp-content\/plugins\/thumbnail-for-excerpts\/tfe_no_thumb.png\" class=\"alignleft wp-post-image tfe\" alt=\"\" title=\"\" \/><\/a><p>\u770b\u5230\u4e00\u500b\u4e0d\u7528\u5b89\u88dd\u63d2\u4ef6pagenavi\u7684\u8a71\uff0c\u5c31\u53ef\u4ee5\u505a\u5230\u6587\u7ae0\u5206\u9801\u529f\u80fd\u3002 \u5be6\u5728\u5f37\u5927\u3002 \u662f\u53f0\u7063\u5927\u5e2b\u4fee\u6539\u7684code\u3002 \u9996\u5148\u6253\u958btheme\u5165\u9762\u7684function.php\u3002 \u5982\u679c\u7528twenty ten\u7684\u8a71\uff0c\u5728endif \u524d\u9762 \u52a0\u5165\u5982\u4e0b\u4ee3\u78bc:<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[297],"tags":[1561],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1413"}],"collection":[{"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1413"}],"version-history":[{"count":0,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1413\/revisions"}],"wp:attachment":[{"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}