{"id":1751,"date":"2010-07-20T13:53:07","date_gmt":"2010-07-20T05:53:07","guid":{"rendered":"http:\/\/ygs.im\/?p=1751"},"modified":"2010-07-20T13:53:07","modified_gmt":"2010-07-20T05:53:07","slug":"wordpress%e8%b0%83%e7%94%a8%e6%9c%80%e6%96%b0%e8%af%84%e8%ae%ba","status":"publish","type":"post","link":"https:\/\/ygs.im\/?p=1751","title":{"rendered":"WordPress \u8c03\u7528\u6700\u65b0\u8bc4\u8bba"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u4f60\u7684\u6a21\u677f\u6ca1\u6709\u8bc4\u8bba\u680f\u76ee\uff1f\u53ef\u4ee5\u4f7f\u7528\u8fb9\u680f\u5c0f\u5de5\u5177\u6dfb\u52a0\uff0c\u4f46\u662f\u4f7f\u7528\u4e86\u8fb9\u680f\u5de5\u5177\u5bf9\u4e8e\u4e0d\u540c\u9875\u9762\u663e\u793a\u4e0d\u540c\u680f\u76ee\u4e0d\u597d\u63a7\u5236\uff0c\u6240\u4ee5\u6211\u5e76\u6ca1\u6709\u4f7f\u7528\uff0c\u53c8\u6240\u4ee5\u4f7f\u7528\u4e86\u81ea\u5df1\u6dfb\u52a0\u4ee3\u7801\u7684\u65b9\u6cd5\uff0c\u4ee3\u7801\u5982\u4e0b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nglobal $wpdb;\n$sql = \"SELECT DISTINCT ID, post_title, post_password, comment_ID,\ncomment_post_ID, comment_author, comment_date_gmt, comment_approved,\ncomment_type,comment_author_url,\nSUBSTRING(comment_content,1,30) AS com_excerpt\nFROM $wpdb-&gt;comments\nLEFT OUTER JOIN $wpdb-&gt;posts ON ($wpdb-&gt;comments.comment_post_ID =\n$wpdb-&gt;posts.ID)\nWHERE comment_approved = '1' AND comment_type = '' AND\npost_password = '' AND user_id != '1'\nORDER BY comment_date_gmt DESC\nLIMIT 10\";\n$comments = $wpdb-&gt;get_results($sql);\n$output = $pre_html;\n\nforeach ($comments as $comment) {\n$output .= \"n&lt;li&gt;\".strip_tags($comment-&gt;comment_author)\n.\":\" . \" &lt;a href=\"\" . get_permalink($comment-&gt;ID) .\n\"#comment-\" . $comment-&gt;comment_ID . \"\" title=\"\" .\n$comment-&gt;post_title . \"\"&gt;\" . strip_tags($comment-&gt;com_excerpt)\n.\"&lt;\/a&gt;&lt;\/li&gt;\";\n}\n$output .= $post_HTML;\necho $output;\n?&gt;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5176\u4e2d user_id != &#8216;1&#8217; \u7684\u529f\u80fd\u4e3a\u9690\u85cf\u7ba1\u7406\u5458(ID=1)\u7684\u8bc4\u8bba\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f60\u7684\u6a21\u677f\u6ca1\u6709\u8bc4\u8bba\u680f\u76ee\uff1f\u53ef\u4ee5\u4f7f\u7528\u8fb9\u680f\u5c0f\u5de5\u5177\u6dfb\u52a0\uff0c\u4f46\u662f\u4f7f\u7528\u4e86\u8fb9\u680f\u5de5\u5177\u5bf9\u4e8e\u4e0d\u540c\u9875\u9762\u663e\u793a\u4e0d\u540c\u680f\u76ee\u4e0d\u597d\u63a7\u5236\uff0c\u6240\u4ee5\u6211\u5e76\u6ca1\u6709 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-1751","post","type-post","status-publish","format-standard","hentry","category-note"],"_links":{"self":[{"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/posts\/1751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1751"}],"version-history":[{"count":0,"href":"https:\/\/ygs.im\/index.php?rest_route=\/wp\/v2\/posts\/1751\/revisions"}],"wp:attachment":[{"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ygs.im\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}