{"id":1461,"date":"2011-01-07T09:16:22","date_gmt":"2011-01-07T09:16:22","guid":{"rendered":"http:\/\/chan.nds.hk\/blog\/?p=1461"},"modified":"2011-01-07T09:16:22","modified_gmt":"2011-01-07T09:16:22","slug":"%e4%bd%bf%e7%94%a8%e4%bb%a3%e7%a2%bc%e5%af%a6%e7%8f%be%e9%9a%a8%e6%a9%9f%e6%96%87%e7%ab%a0%e3%80%81%e7%9b%b8%e9%97%9c%e6%96%87%e7%ab%a0%e3%80%81%e6%96%87%e7%ab%a0%e5%88%86%e9%a0%81%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/chan.nds.hk\/blog\/?p=1461","title":{"rendered":"\u4f7f\u7528\u4ee3\u78bc\u5be6\u73fe\u96a8\u6a5f\u6587\u7ae0\u3001\u76f8\u95dc\u6587\u7ae0\u3001\u6587\u7ae0\u5206\u9801\u529f\u80fd"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p><span style=\"font-size:14px;\">\u5148\u5728functions\u88e1\u5beb\u597d\u51fd\u6578\u518d\u5230\u4f48\u666f\u88e1\u8abf\u7528\uff0c\u9019\u6a23\u5728\u4f48\u666f\u88e1\u770b\u5230\u7684\u51fd\u6578\u5c31\u4e0d\u6703\u611f\u89ba\u4e82\u4e82\u7684\uff0c\u5f80\u5f8c\u6bd4\u8f03\u597d\u4fee\u6539\uff0c<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u96a8\u6a5f\u6587\u7ae0\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u524d\u53f0\u547c\u53eb\u8a9e\u6cd5\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;?php s_random_lists(); ?&gt;<!--more--><\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u4ee5\u4e0b\u5167\u5bb9\u52a0\u5165functions.php<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;?php<\/span><\/p>\n<p><span style=\"font-size:14px;\">function s_random_lists($num_limit = 5 , $exclude = &quot;&quot; , $date_limit = &quot;&quot; , $echo = true , $list = true){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$out = &quot;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( $num_limit &lt; 1 ) $num_limit = &quot;-1&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( !$date_limit_ts = strtotime($date_limit) ) $date_limit = false;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( !$date_limit ){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$posts = get_posts(&#39;offset=0&amp;numberposts=&#39;.$num_limit.&#39;&amp;exclude=&#39;.$exclude.&#39;&amp;orderby=rand&#39;);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$posts = get_posts(&#39;offset=0&amp;numberposts=-1&amp;exclude=&#39;.$exclude.&#39;&amp;orderby=rand&#39;);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$postscount = count($posts);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( $num_limit &lt; 1 ) $num_limit = $postscount;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( $postscount &lt; $num_limit ) $num_limit = $postscount ;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for ( $i = 0 ; $i &lt; $num_limit ; $i++ ){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( !$date_limit or $date_limit_ts &lt; strtotime( $posts[$i]-&gt;post_date )){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ( $list ) $out.= &#39;&lt;li class=&quot;random-post-link&quot;&gt;&#39;.&quot;\\n&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$out.= &#39;&lt;a href=&quot;&#39;.get_permalink($posts[$i]-&gt;ID).&#39;&quot; title=&quot;&#39;.$posts[$i]-&gt;post_title.&#39;&quot;&gt;&#39;.$posts[$i]-&gt;post_title.&#39;&lt;\/a&gt;&#39;.&quot;\\n&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ( $list ) $out.= &#39;&lt;\/li&gt;&#39;.&quot;\\n&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}else{<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if ( $postscount &gt; $num_limit ) $num_limit++;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( $list ) $out = &#39;&lt;ul class=&quot;random-post-link&quot;&gt;&#39;.&quot;\\n&quot;.$out.&#39;&lt;\/ul&gt;&#39;.&quot;\\n&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( $echo ){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo $out;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else {<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return $out;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">?&gt;<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u986f\u793a\u6587\u7ae0\u6578\u91cf\u8a2d\u5b9a\uff1a$num_limit = 5 \uff0c\u4fee\u6539\u70ba\u8981\u986f\u793a\u7684\u6578\u91cf\u5373\u53ef\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u76f8\u95dc\u6587\u7ae0\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u524d\u53f0\u547c\u53eb\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;?php s_related_posts(); ?&gt;<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u4ee5\u4e0b\u5167\u5bb9\u52a0\u5165functions.php<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;?php<\/span><\/p>\n<p><span style=\"font-size:14px;\">function srelated_posts($before_title=&quot;&quot;,$after_title=&quot;&quot;) { &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;global $wpdb, $post,$table_prefix;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;if(!$post-&gt;ID){return;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$now = current_time(&#39;mysql&#39;, 1);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$tags = wp_get_post_tags($post-&gt;ID);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$taglist = &quot;&#39;&quot; . $tags[0]-&gt;term_id. &quot;&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$tagcount = count($tags);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;if ($tagcount &gt; 1) {<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for ($i = 1; $i &lt; $tagcount; $i++) {<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$taglist = $taglist . &quot;, &#39;&quot; . $tags[$i]-&gt;term_id . &quot;&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;} &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$limitclause = &quot;LIMIT 5&quot;; &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$q = &quot;SELECT p.ID, p.post_title, p.post_content,p.post_excerpt, p.post_date, &nbsp;p.comment_count, count(t_r.object_id) as cnt FROM $wpdb-&gt;term_taxonomy t_t, $wpdb-&gt;term_relationships t_r, $wpdb-&gt;posts p WHERE t_t.taxonomy =&#39;post_tag&#39; AND t_t.term_taxonomy_id = t_r.term_taxonomy_id AND t_r.object_id &nbsp;= p.ID AND (t_t.term_id IN ($taglist)) AND p.ID != $post-&gt;ID AND p.post_status = &#39;publish&#39; AND p.post_date_gmt &lt; &#39;$now&#39; GROUP BY t_r.object_id ORDER BY cnt DESC, p.post_date_gmt DESC $limitclause;&quot;; &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$related_posts = $wpdb-&gt;get_results($q);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;foreach ($related_posts as $related_post ){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$output .= &nbsp;&#39;&lt;li&gt;&lt;a href=&quot;&#39;.get_permalink($related_post-&gt;ID).&#39;&quot; title=&quot;&#39;.wptexturize($related_post-&gt;post_title).&#39;&quot;&gt;&#39;.wptexturize($related_post-&gt;post_title).&#39;&lt;\/a&gt;&lt;\/li&gt;&#39;; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;} &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$output = &#39;&lt;ul class=&quot;related_post&quot;&gt;&#39; . $output . &#39;&lt;\/ul&gt;&#39;; &nbsp; &nbsp; &nbsp; &nbsp;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;return $output;<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">function s_related_posts(){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$output = srelated_posts() ;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;echo $output;<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">?&gt;<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u986f\u793a\u6587\u7ae0\u6578\u91cf\u8a2d\u5b9a\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">$limitclause = &quot;LIMIT 5&quot;;\uff0c\u4fee\u6539\u70ba\u8981\u986f\u793a\u7684\u6578\u91cf\u5373\u53ef\u3002<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u6587\u7ae0\u5206\u9801\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u524d\u53f0\u547c\u53eb\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;div id=&quot;spagenavi&quot;&gt;&lt;?php s_pagenavi(); ?&gt;&lt;\/div&gt;<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">CSS\u90e8\u4efd(style.css)\uff1a<\/span><\/p>\n<p><span style=\"font-size:14px;\">#paviinfo{border: 3px double #bfbfbf;padding:2px 5px;margin:0 2px;float:left;text-align:center;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">#spagenavi{float:right;font-size:13px;font-family:Arial;display:inline-block;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">#spagenavi a{color: #333;float:left;padding:2px 5px;border: 3px double #bfbfbf;margin:0 2px;text-decoration:none;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">#spagenavi a:hover{border-color: #BA0000;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">#spagenavi a.current{border-color: #0075b8;}<\/span><\/p>\n<p><span style=\"font-size:14px;\"><br \/>\n\t<\/span><\/p>\n<p><span style=\"font-size:14px;\">\u4ee5\u4e0b\u5167\u5bb9\u52a0\u5165functions.php<\/span><\/p>\n<p><span style=\"font-size:14px;\">&lt;?php<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;function s_pagenavi($range = 6){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp;global $paged, $wp_query;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp;if ( !$max_page ) {<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;$max_page = $wp_query-&gt;max_num_pages;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp;if($max_page &gt; 1){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;if(!$paged){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;$paged = 1;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">echo &#39;&lt;div id=&quot;paviinfo&quot;&gt;\u6587\u7ae0\u9801\u6b21&#39;.$paged.&#39;\/&#39;.$max_page.&#39;&lt;\/div&gt;&#39;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;if($paged != 1){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;echo &quot;&lt;a href=&#39;&quot; . get_pagenum_link(1) . &quot;&#39; class=&#39;extend&#39; title=&#39;\u9996\u9801&#39;&gt;\u9996\u9801&lt;\/a&gt;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;previous_posts_link(&#39; &laquo; &#39;);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;if($max_page &gt; $range){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;if($paged &lt; $range){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for($i = 1; $i &lt;= ($range + 1); $i++){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&lt;a title=&quot;.&#39;&quot;\u7b2c&#39;.$i.&#39;\u9801&quot;&#39;. &quot;href=&#39;&quot; . get_pagenum_link($i) .&quot;&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if($i==$paged) echo &quot; class=&#39;current&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&gt;$i&lt;\/a&gt;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;elseif($paged &gt;= ($max_page - ceil(($range\/2)))){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for($i = $max_page - $range; $i &lt;= $max_page; $i++){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&lt;a title=&quot;.&#39;&quot;\u7b2c&#39;.$i.&#39;\u9801&quot;&#39;. &quot;href=&#39;&quot; . get_pagenum_link($i) .&quot;&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if($i==$paged) echo &quot; class=&#39;current&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&gt;$i&lt;\/a&gt;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;elseif($paged &gt;= $range &amp;&amp; $paged &lt; ($max_page - ceil(($range\/2)))){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for($i = ($paged - ceil($range\/2)); $i &lt;= ($paged + ceil(($range\/2))); $i++){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&lt;a title=&quot;.&#39;&quot;\u7b2c&#39;.$i.&#39;\u9801&quot;&#39;. &quot;href=&#39;&quot; . get_pagenum_link($i) .&quot;&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if($i==$paged) echo &quot; class=&#39;current&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&gt;$i&lt;\/a&gt;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;else{<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;for($i = 1; $i &lt;= $max_page; $i++){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&lt;a title=&quot;.&#39;&quot;\u7b2c&#39;.$i.&#39;\u9801&quot;&#39;. &quot;href=&#39;&quot; . get_pagenum_link($i) .&quot;&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if($i==$paged) echo &quot; class=&#39;current&#39;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;&gt;$i&lt;\/a&gt;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;next_posts_link(&#39; &raquo; &#39;);<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;if($paged != $max_page){<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp; &nbsp;echo &quot;&lt;a href=&#39;&quot; . get_pagenum_link($max_page) . &quot;&#39; class=&#39;extend&#39; title=&#39;\u6700\u5f8c\u4e00\u9801&#39;&gt;\u6700\u5f8c\u4e00\u9801&lt;\/a&gt;&quot;;<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp;}<\/span><\/p>\n<p><span style=\"font-size:14px;\">}<\/span><\/p>\n<p><span style=\"font-size:14px;\">&nbsp;&nbsp; &nbsp;?&gt;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/chan.nds.hk\/blog\/?p=1461\"><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>&nbsp; \u5148\u5728functions\u88e1\u5beb\u597d\u51fd\u6578\u518d\u5230\u4f48\u666f\u88e1\u8abf\u7528\uff0c\u9019\u6a23\u5728\u4f48\u666f\u88e1\u770b\u5230\u7684\u51fd\u6578\u5c31\u4e0d\u6703\u611f\u89ba\u4e82\u4e82\u7684\uff0c\u5f80\u5f8c\u6bd4\u8f03\u597d\u4fee\u6539\uff0c \u96a8\u6a5f\u6587\u7ae0\uff1a \u524d\u53f0\u547c\u53eb\u8a9e\u6cd5\uff1a &lt;?php s_random_lists(); ?&gt;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[310],"tags":[1561],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1461"}],"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=1461"}],"version-history":[{"count":0,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1461\/revisions"}],"wp:attachment":[{"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chan.nds.hk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}