{"id":2017,"date":"2010-02-23T17:10:41","date_gmt":"2010-02-23T09:10:41","guid":{"rendered":"https:\/\/www.wopus.org\/?p=2017"},"modified":"2010-02-23T17:10:41","modified_gmt":"2010-02-23T09:10:41","slug":"wordpress%e7%9b%b8%e5%85%b3%e6%97%a5%e5%bf%97%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/wopus.org\/?p=2017","title":{"rendered":"WordPress\u76f8\u5173\u65e5\u5fd7\u51fd\u6570"},"content":{"rendered":"<p>\u4e0d\u7528<span class=\"bm_keywordlink_affiliate\">\u63d2\u4ef6<\/span>\u5b9e\u73b0\u4e00\u4e9b\u5e38\u7528\u529f\u80fd\u662f\u4e0a\u4e0a\u4e4b\u9009\uff0c\u4e4b\u524d\u7f51\u4e0a\u76db\u4f20\u7684\u4e0d\u4f7f\u7528\u63d2\u4ef6\u5c31\u80fd\u5b9e\u73b0\u7684\u4e94\u4e2a\u5e38\u7528\u529f\u80fd\u4e00\u6587\u4e2d\u7684\u76f8\u5173 \u65e5\u5fd7\u51fd\u6570\uff0c\u4e0d\u662f\u5f88\u5b8c\u5584\uff0c\u52a0\u5230\u5355\u7bc7\u65e5\u5fd7\u540e\uff0c\u4e0b\u9762\u7684\u8bc4\u8bba\u4f1a\u53d8\u6210\u6700\u540e\u4e00\u7bc7\u76f8\u5173\u65e5\u5fd7\u7684\u8bc4\u8bba\uff0c\u5927\u6982\u662floop\u51fa\u4e86\u95ee\u9898\u3002\u800c\u8fd9\u6bb5\u4ee3\u7801\u4e0d\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u5f0a\u75c5\uff0c\u5e76\u4e14\u5728\u6ca1\u6709\u76f8\u5173\u65e5\u5fd7\u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u663e\u793a\u968f\u673a\u65e5\u5fd7\u3002\u539f\u51fd\u6570\u5728\u6ca1\u6709\u76f8\u5173\u65e5\u5fd7\u65f6\uff0c\u663e\u793a\u6700\u65b0\u6587\u7ae0\uff0c\u4fee\u6539\u4e3a\u663e\u793a\u968f\u673a\u65e5\u5fd7\u3002\u5c06\u8fd9\u6bb5\u4ee3\u7801\u52a0\u5230single.php\u6a21\u677f\u6587\u4ef6<br \/>\n&lt;?php  comments_template(); ?&gt;<br \/>\n\u4e0a\u9762\u5373\u53ef\uff0c\u4e4b\u540e\u53ef\u4ee5\u5220\u9664\u76f8\u5173\u65e5\u5fd7\u63d2\u4ef6\u4e86\uff01<\/p>\n<p><strong>\u76f8\u5173\u65e5\u5fd7\u4ee3\u7801\uff1a<\/strong><br \/>\n<coolcode lang=\"\"><\/p>\n<div class=\"relatedposts\">\n< ?php\n  $backup = $post; \n  $tags = wp_get_post_tags($post->ID);<br \/>\n  $tagIDs = array();<br \/>\n  if ($tags) {<br \/>\n\techo &#8216;<\/p>\n<h4>\u76f8\u5173\u65e5\u5fd7<\/h4>\n<p>&#8216;;<br \/>\n\techo &#8216;<\/p>\n<ul>&#8216;;<br \/>\n    $tagcount = count($tags);<br \/>\n    for ($i = 0; $i < $tagcount; $i++) {\n      $tagIDs[$i] = $tags[$i]->term_id;<br \/>\n    }<br \/>\n    $args=array(<br \/>\n      &#8216;tag__in&#8217; => $tagIDs,<br \/>\n      &#8216;post__not_in&#8217; => array($post->ID),<br \/>\n      &#8216;showposts&#8217;=>4,<!-- \u663e\u793a\u7684\u76f8\u5173\u65e5\u5fd7\u7bc7\u6570 --><br \/>\n      &#8216;caller_get_posts&#8217;=>1<br \/>\n    );<br \/>\n    $my_query = new WP_Query($args);<br \/>\n    if( $my_query->have_posts() ) {<br \/>\n      while ($my_query->have_posts()) : $my_query->the_post(); ?><\/p>\n<li><a href=\"<?php the_permalink() ?>&#8221; rel=&#8221;bookmark&#8221; title=&#8221;< ?php the_title(); ?>&#8220;>< ?php the_title(); ?><\/a><\/li>\n<p>      < ?php endwhile;\n\t  \techo '<\/ul>\n<p>&#8216;;<br \/>\n    } else { ?>\n<\/ul>\n<ul>\n\t< ?php\n\tquery_posts(array('orderby' => &#8216;rand&#8217;, &#8216;showposts&#8217; => 8));<!-- \u663e\u793a\u968f\u673a\u65e5\u5fd7\u7bc7\u6570 --><br \/>\n\tif (have_posts()) :<br \/>\n\twhile (have_posts()) : the_post();?><\/p>\n<li><a href=\"<?php the_permalink() ?>&#8221; rel=&#8221;bookmark&#8221; title=&#8221;Permanent Link to < ?php the_title(); ?>&#8220;>< ?php the_title(); ?><\/a><\/li>\n<p>\t< ?php endwhile;endif; ?>\n<\/ul>\n<p>< ?php }\n  }\n  $post = $backup;\n  wp_reset_query();\n?>\n<\/div>\n<p><\/coolcode><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0d\u7528\u63d2\u4ef6\u5b9e\u73b0\u4e00\u4e9b\u5e38\u7528\u529f\u80fd\u662f\u4e0a\u4e0a\u4e4b\u9009\uff0c\u4e4b\u524d\u7f51\u4e0a\u76db\u4f20\u7684\u4e0d\u4f7f\u7528\u63d2\u4ef6\u5c31\u80fd\u5b9e\u73b0\u7684\u4e94\u4e2a\u5e38\u7528\u529f\u80fd\u4e00\u6587\u4e2d\u7684\u76f8\u5173 \u65e5\u5fd7\u51fd\u6570\uff0c\u4e0d\u662f\u5f88\u5b8c\u5584\uff0c\u52a0\u5230\u5355\u7bc7\u65e5\u5fd7\u540e\uff0c\u4e0b\u9762\u7684\u8bc4\u8bba\u4f1a\u53d8\u6210\u6700\u540e\u4e00\u7bc7\u76f8\u5173\u65e5\u5fd7\u7684\u8bc4\u8bba\uff0c\u5927\u6982\u662floop\u51fa\u4e86\u95ee\u9898\u3002\u800c\u8fd9\u6bb5\u4ee3\u7801\u4e0d\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u5f0a\u75c5\uff0c\u5e76\u4e14\u5728\u6ca1\u6709\u76f8\u5173\u65e5\u5fd7\u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u663e\u793a\u968f\u673a\u65e5\u5fd7\u3002\u539f\u51fd\u6570\u5728\u6ca1\u6709\u76f8\u5173\u65e5\u5fd7\u65f6\uff0c\u663e\u793a\u6700\u65b0\u6587\u7ae0\uff0c\u4fee\u6539\u4e3a\u663e\u793a\u968f\u673a\u65e5\u5fd7\u3002\u5c06\u8fd9\u6bb5\u4ee3\u7801\u52a0\u5230single.php\u6a21\u677f\u6587\u4ef6 &lt;?php comments_template(); ?&gt; \u4e0a\u9762\u5373\u53ef\uff0c\u4e4b\u540e\u53ef\u4ee5\u5220\u9664\u76f8\u5173\u65e5\u5fd7\u63d2\u4ef6\u4e86\uff01 \u76f8\u5173\u65e5\u5fd7\u4ee3\u7801\uff1a < ?php $backup = $post; $tags = wp_get_post_tags($post->ID); $tagIDs = array(); if ($tags) { echo &#8216; \u76f8\u5173\u65e5\u5fd7 &#8216;; echo &#8216; &#8216;; $tagcount = count($tags); for ($i = 0; $i < $tagcount; $i++) { $tagIDs[$i] = $tags[$i]->term_id; } $args=array( &#8216;tag__in&#8217; => $tagIDs, &#8216;post__not_in&#8217; => array($post->ID), &#8216;showposts&#8217;=>4, &#8216;caller_get_posts&#8217;=>1 ); $my_query [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[557],"class_list":["post-2017","post","type-post","status-publish","format-standard","hentry","category-wordpress-deepin","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/2017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2017"}],"version-history":[{"count":0,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/2017\/revisions"}],"wp:attachment":[{"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}