{"id":1199,"date":"2025-06-10T04:00:38","date_gmt":"2025-06-09T20:00:38","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/1199.html"},"modified":"2025-06-10T04:00:38","modified_gmt":"2025-06-09T20:00:38","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8wordpress%e4%be%a7%e8%be%b9%e6%a0%8f%e6%98%be%e7%a4%ba%e6%9c%80%e8%bf%91%e7%9a%84%e8%af%84%e8%ae%ba","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/1199.html","title":{"rendered":"\u5982\u4f55\u5728WordPress\u4fa7\u8fb9\u680f\u663e\u793a\u6700\u8fd1\u7684\u8bc4\u8bba"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<h2 class=\"wp-block-heading my-0\">&#20889; Bug&#24037;&#31243;&#24072;&#65306;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#35201;&#22312;WordPress&#20391;&#36793;&#26639;&#26174;&#31034;&#26368;&#36817;&#30340;&#35780;&#35770;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#33258;&#23450;&#20041;&#20391;&#36793;&#26639;&#25110;&#25554;&#20214;&#26469;&#23454;&#29616;&#36825;&#20010;&#21151;&#33021;&#12290;&#20197;&#19979;&#26159;&#19968;&#20010;&#22522;&#26412;&#30340;&#26041;&#27861;&#21644;&#31034;&#20363;&#20195;&#30721;&#65292;&#24110;&#21161;&#20320;&#22312;WordPress&#20013;&#28155;&#21152;&#19968;&#20010;&#26174;&#31034;&#26368;&#36817;&#35780;&#35770;&#30340;&#20391;&#36793;&#26639;&#12290;<\/p>\n<h3>&#26041;&#27861;&#19968;&#65306;&#20351;&#29992;&#33258;&#23450;&#20041;&#20391;&#36793;&#26639;<\/h3>\n<ol>\n<li>\n<p><strong>&#21019;&#24314;&#19968;&#20010;&#26032;&#30340;&#20391;&#36793;&#26639;<\/strong>&#65306;<\/p>\n<ul>\n<li>&#30331;&#24405;&#21040;WordPress&#21518;&#21488;&#12290;<\/li>\n<li>&#36716;&#21040;&ldquo;&#22806;&#35266;&rdquo; -&gt; &ldquo;&#27169;&#26495;&#32534;&#36753;&#22120;&rdquo;&#12290;<\/li>\n<li>&#22312;&#24038;&#20391;&#23548;&#33322;&#26639;&#36873;&#25321;&ldquo;&#20391;&#36793;&#26639;&rdquo;&#65292;&#28982;&#21518;&#28857;&#20987;&ldquo;&#28155;&#21152;&#26032;&#26639;&#20301;&rdquo;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#32534;&#20889;PHP&#20195;&#30721;<\/strong>&#65306;\n&#20026;&#20102;&#26174;&#31034;&#26368;&#36817;&#30340;&#35780;&#35770;&#65292;&#20320;&#38656;&#35201;&#32534;&#20889;&#19968;&#20123;PHP&#20195;&#30721;&#26469;&#33719;&#21462;&#36825;&#20123;&#25968;&#25454;&#24182;&#23558;&#20854;&#23637;&#31034;&#22312;&#20391;&#36793;&#26639;&#19978;&#12290;&#36825;&#37324;&#25552;&#20379;&#19968;&#20010;&#31616;&#21333;&#30340;&#31034;&#20363;&#65306;<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"language-php\">&lt;?php\n\/\/ &#33719;&#21462;&#26368;&#36817;5&#26465;&#35780;&#35770;\n$args = array(\n    'number' =&gt; 5,\n    'orderby' =&gt; 'comment_date',\n    'order' =&gt; 'DESC'\n);\n$comments = get_comments($args);\n\n\/\/ &#36941;&#21382;&#27599;&#26465;&#35780;&#35770;&#24182;&#36755;&#20986;\nforeach ($comments as $comment) {\n    echo '&lt;div class=\"recent-comment\"&gt;';\n    echo '&lt;h3&gt;' . esc_html($comment-&gt;comment_author) . '&lt;\/h3&gt;';\n    echo '&lt;span&gt;' . esc_html($comment-&gt;comment_content) . '&lt;\/span&gt;';\n    echo '&lt;\/div&gt;';\n}\n?&gt;<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>&#26679;&#24335;&#21270;&#65288;&#21487;&#36873;&#65289;<\/strong>&#65306;\n&#22914;&#26524;&#20320;&#24819;&#35753;&#36825;&#20010;&#37096;&#20998;&#30475;&#36215;&#26469;&#26356;&#32654;&#35266;&#65292;&#21487;&#20197;&#20026;&#23427;&#28155;&#21152;CSS&#26679;&#24335;&#12290;&#20363;&#22914;&#65306;<\/li>\n<\/ol>\n<pre><code class=\"language-css\">.recent-comment {\n    background: #f9f9f9;\n    padding: 10px;\n    border-bottom: 1px solid #eaeaea;\n}\n\n.recent-comment h3 {\n    margin: 0;\n    font-size: 16px;\n    color: #333;\n}\n\n.recent-comment span {\n    font-style: italic;\n}<\/code><\/pre>\n<ol start=\"4\">\n<li><strong>&#26356;&#26032;&#20027;&#39064;&#25991;&#20214;<\/strong>&#65306;\n&#23558;&#19978;&#36848;PHP&#20195;&#30721;&#20445;&#23384;&#21040;&#20320;&#30340;&#20027;&#39064;&#30340;<code>functions.php<\/code>&#25991;&#20214;&#25110;&#32773;&#19968;&#20010;&#21333;&#29420;&#30340;PHP&#25991;&#20214;&#20013;&#65292;&#24182;&#30830;&#20445;&#35813;&#25991;&#20214;&#20301;&#20110;&#27491;&#30830;&#30340;&#30446;&#24405;&#32467;&#26500;&#19979;&#12290;<\/li>\n<\/ol>\n<h3>&#31034;&#20363;&#20195;&#30721;&#25191;&#34892;&#27493;&#39588;&#65306;<\/h3>\n<ol>\n<li>&#25171;&#24320;&#20320;&#30340;&#20027;&#39064;&#25991;&#20214;&#22841;&#20013;&#30340;<code>functions.php<\/code>&#25991;&#20214;&#12290;<\/li>\n<li>&#22797;&#21046;&#19978;&#38754;&#25552;&#20379;&#30340;PHP&#20195;&#30721;&#31896;&#36148;&#21040;&#20320;&#30340;<code>functions.php<\/code>&#25991;&#20214;&#20013;&#12290;<\/li>\n<li>&#20351;&#29992;&#25991;&#26412;&#32534;&#36753;&#22120;&#65288;&#22914;Sublime Text&#12289;Visual Studio Code&#31561;&#65289;&#25171;&#24320;<code>functions.php<\/code>&#25991;&#20214;&#12290;<\/li>\n<li>&#20445;&#23384;&#20462;&#25913;&#21518;&#30340;&#25991;&#20214;&#12290;<\/li>\n<li>&#22312;&#27983;&#35272;&#22120;&#20013;&#21047;&#26032;&#39029;&#38754;&#26597;&#30475;&#32467;&#26524;&#12290;<\/li>\n<\/ol>\n<h3>&#25928;&#26524;&#35828;&#26126;&#65306;<\/h3>\n<ul>\n<li>&#24403;&#20320;&#35775;&#38382;&#32593;&#31449;&#26102;&#65292;&#20250;&#30475;&#21040;&#19968;&#20010;&#20391;&#36793;&#26639;&#21306;&#22495;&#26174;&#31034;&#20102;&#26368;&#36817;&#20116;&#26465;&#35780;&#35770;&#30340;&#20869;&#23481;&#12290;<\/li>\n<li>&#27599;&#26465;&#35780;&#35770;&#37117;&#20250;&#21253;&#21547;&#20316;&#32773;&#21517;&#21644;&#35780;&#35770;&#20869;&#23481;&#12290;<\/li>\n<li>&#21487;&#20197;&#36890;&#36807;&#35843;&#25972;CSS&#26679;&#24335;&#26469;&#32654;&#21270;&#36825;&#20010;&#21306;&#22495;&#65292;&#20351;&#20854;&#19982;&#25972;&#20010;&#32593;&#31449;&#39118;&#26684;&#19968;&#33268;&#12290;<\/li>\n<\/ul>\n<p>&#20197;&#19978;&#23601;&#26159;&#20351;&#29992;PHP&#21644;HTML&#31616;&#21333;&#23454;&#29616;WordPress&#20391;&#36793;&#26639;&#26174;&#31034;&#26368;&#36817;&#35780;&#35770;&#30340;&#22522;&#26412;&#26041;&#27861;&#12290;&#22914;&#26524;&#20320;&#38656;&#35201;&#26356;&#22797;&#26434;&#30340;&#21151;&#33021;&#65292;&#27604;&#22914;&#25490;&#24207;&#26041;&#24335;&#12289;&#20998;&#39029;&#31561;&#65292;&#21487;&#33021;&#38656;&#35201;&#32467;&#21512;&#26356;&#22810;&#30340;WordPress&#25554;&#20214;&#25110;&#39640;&#32423;&#30340;&#23450;&#21046;&#24037;&#20316;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<h2 class=\"wp-block-heading my-0\">&#40657;&#26495;IDE&#25945;&#20070;&#21280;&#65306;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#22312;WordPress&#20013;&#65292;&#35201;&#23558;&#26368;&#36817;&#30340;&#35780;&#35770;&#26174;&#31034;&#21040;&#20391;&#36793;&#26639;&#65292;&#21487;&#20197;&#20351;&#29992;WordPress&#30340;&#20869;&#32622;&#21151;&#33021;&#21644;&#25554;&#20214;&#26469;&#23454;&#29616;&#12290;&#19979;&#38754;&#26159;&#19968;&#20123;&#27493;&#39588;&#21644;&#31034;&#20363;&#20195;&#30721;&#65306;<\/p>\n<h3>&#27493;&#39588; 1: &#28155;&#21152;&#35780;&#35770;&#27169;&#22359;<\/h3>\n<p>&#39318;&#20808;&#65292;&#22312;WordPress&#30340;&#20027;&#39064;&#25110;&#27169;&#26495;&#25991;&#20214;&#20013;&#28155;&#21152;&#19968;&#20010;&#35780;&#35770;&#27169;&#22359;&#12290;&#36825;&#36890;&#24120;&#36890;&#36807;&#20351;&#29992;<code>comment_form.php<\/code>&#25991;&#20214;&#20013;&#30340;<code>comments_template<\/code>&#36873;&#39033;&#26469;&#23436;&#25104;&#12290;<\/p>\n<pre><code class=\"language-php\">&lt;?php if ( ! defined( 'ABSPATH' ) ) exit; \/\/ Exit if accessed directly ?&gt;\n&lt;!-- Your comment form here --&gt;<\/code><\/pre>\n<h3>&#27493;&#39588; 2: &#21019;&#24314;&#35780;&#35770;&#21306;&#22495;<\/h3>\n<p>&#25509;&#19979;&#26469;&#65292;&#22312;&#20027;&#39064;&#30340;CSS&#25991;&#20214;&#20013;&#21019;&#24314;&#19968;&#20010;&#31867;&#65292;&#29992;&#20110;&#20026;&#35780;&#35770;&#21306;&#22495;&#20998;&#37197;&#26679;&#24335;&#24182;&#25918;&#32622;&#22312;&#39029;&#38754;&#24213;&#37096;&#12290;<\/p>\n<pre><code class=\"language-css\">\/* Add a class to the comments *\/\n.comments {\n    display: flex;\n    justify-content: center;\n}<\/code><\/pre>\n<h3>&#27493;&#39588; 3: &#22312;&#20391;&#36793;&#26639;&#20013;&#26174;&#31034;&#35780;&#35770;<\/h3>\n<p>&#35201;&#22312;&#20391;&#36793;&#26639;&#20013;&#26174;&#31034;&#35780;&#35770;&#65292;&#21487;&#20197;&#22312;&#20391;&#36793;&#26639;&#20803;&#32032;&#65288;&#22914;&#23548;&#33322;&#33756;&#21333;&#65289;&#19978;&#24212;&#29992;&#31867;&#21517;&#65292;&#22914;&#19979;&#25152;&#31034;&#65306;<\/p>\n<pre><code class=\"language-html\">&lt;nav id=\"sidebar\" class=\"site-navigation\"&gt;\n    &lt;!-- Your sidebar content goes here --&gt;\n&lt;\/nav&gt;\n\n&lt;div class=\"comments\"&gt;\n    &lt;!-- Your comment section goes here --&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<h3>&#31034;&#20363;&#20195;&#30721;<\/h3>\n<h4>&#20351;&#29992;WordPress&#33258;&#21160;&#29983;&#25104;&#35780;&#35770;&#27169;&#22359;<\/h4>\n<ol>\n<li>\n<p><strong>&#29983;&#25104;&#35780;&#35770;&#27169;&#22359;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-php\">&lt;?php wp_enqueue_script('comment-form'); ?&gt;<\/code><\/pre>\n<p>&#36825;&#34892;&#20195;&#30721;&#20250;&#33258;&#21160;&#21152;&#36733;<code>comment-form.js<\/code>&#33050;&#26412;&#65292;&#20174;&#32780;&#22312;&#26032;&#35780;&#35770;&#25552;&#20132;&#26102;&#33258;&#21160;&#29983;&#25104;&#35780;&#35770;&#34920;&#21333;&#12290;<\/p>\n<\/li>\n<li>\n<p><strong>&#22312;&#20391;&#36793;&#26639;&#26174;&#31034;&#35780;&#35770;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-html\">&lt;div class=\"comments\"&gt;\n   &lt;?php if ( have_comments() ) : ?&gt;\n       &lt;ul class=\"comments-list\"&gt;\n           &lt;?php\n               while ( have_comments() ) :\n                   the_comment();\n                   $args = array(\n                       'before_comment_start' =&gt; '&lt;li class=\"comment-item\"&gt;',\n                       'after_comment_end' =&gt; '&lt;\/li&gt;',\n                       'comment_author' =&gt; '&lt;span class=\"comment-author vcard\"&gt;',\n                       'comment_author_link' =&gt; '&lt;a href=\"' . get_comment_author_url() . '\" title=\"' . esc_attr(get_comment_author()) . '\"&gt;' . get_comment_author() . '&lt;\/a&gt;',\n                       'comment_author_email' =&gt; '&lt;span class=\"fn\"&gt;' . esc_html(get_comment_author_email()) . '&lt;\/span&gt;',\n                       'comment_text' =&gt; '&lt;div class=\"comment-text\"&gt;',\n                       'comment_close' =&gt; '&lt;\/div&gt;'\n                   );\n                   the_comment();\n               endwhile;\n\n               wp_list_comments( apply_filters( 'comment_text', '', $args ) );\n           ?&gt;\n       &lt;\/ul&gt;&lt;!-- end of comments list --&gt;\n   &lt;?php endif; ?&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<\/li>\n<\/ol>\n<h4>&#20351;&#29992;&#31532;&#19977;&#26041;&#35780;&#35770;&#27169;&#22359;<\/h4>\n<p>&#22914;&#26524;&#24819;&#35201;&#26356;&#20016;&#23500;&#30340;&#35780;&#35770;&#21151;&#33021;&#65292;&#20363;&#22914;&#25903;&#25345;&#22238;&#22797;&#12289;&#23457;&#26680;&#31561;&#65292;&#21487;&#20197;&#32771;&#34385;&#20351;&#29992;&#31532;&#19977;&#26041;&#35780;&#35770;&#27169;&#22359;&#12290;&#36825;&#37324;&#20197;&#20351;&#29992;<code>CommentPress<\/code>&#20026;&#20363;&#12290;<\/p>\n<ol>\n<li>\n<p><strong>&#23433;&#35013;CommentPress<\/strong><\/p>\n<pre><code class=\"language-bash\">wp plugin install CommentPress<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#28608;&#27963;CommentPress<\/strong><\/p>\n<pre><code class=\"language-bash\">wp plugin activate CommentPress<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#37197;&#32622;CommentPress<\/strong><\/p>\n<ul>\n<li>&#22312;<code>config.php<\/code>&#20013;&#35774;&#32622;&#30456;&#20851;&#21442;&#25968;&#65292;&#22914;&#37038;&#31665;&#39564;&#35777;&#12289;&#35780;&#35770;&#31649;&#29702;&#22120;&#12290;<\/li>\n<li>&#37197;&#32622;&#35780;&#35770;&#34920;&#21333;&#21644;&#23383;&#27573;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>**&#21551;&#29992;CommentPress`<\/p>\n<pre><code class=\"language-bash\">wp switch-theme --activate-commentpress<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#28608;&#27963;&#24182;&#27979;&#35797;CommentPress<\/strong><\/p>\n<pre><code class=\"language-bash\">wp theme switch --activate-commentpress<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#26597;&#30475;&#25928;&#26524;<\/strong>\n&#22312;&#24744;&#30340;&#20391;&#36793;&#26639;&#30475;&#21040;&#24102;&#26377;&#35780;&#35770;&#30340;&#21015;&#34920;&#12290;<\/p>\n<\/li>\n<\/ol>\n<p>&#20197;&#19978;&#23601;&#26159;&#22312;WordPress&#20013;&#23637;&#31034;&#26368;&#36817;&#35780;&#35770;&#30340;&#22522;&#26412;&#26041;&#27861;&#12290;&#26681;&#25454;&#38656;&#27714;&#36873;&#25321;&#21512;&#36866;&#30340;&#27169;&#22359;&#21644;&#24037;&#20855;&#65292;&#20197;&#20415;&#26356;&#22909;&#22320;&#31649;&#29702;&#21644;&#21576;&#29616;&#35780;&#35770;&#20449;&#24687;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&#20889; Bug&#24037;&#31243;&#24072;&#65306; &#35201;&#22312;WordPress&#20391;&#36793;&#26639;&#26174;&#31034;&#26368;&#36817;&#30340;&#35780;&#35770;&#65292;&#038;#..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[49,50],"tuisongtax":[],"class_list":["post-1199","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-rmzn","tag-xsbdtj"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/1199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/comments?post=1199"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/1199\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=1199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=1199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=1199"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=1199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}