{"id":491,"date":"2023-03-02T20:45:05","date_gmt":"2023-03-02T12:45:05","guid":{"rendered":"https:\/\/trollbar.xyz\/?p=491"},"modified":"2024-05-01T22:04:23","modified_gmt":"2024-05-01T14:04:23","slug":"g%e8%80%81%e5%b8%88%e5%80%be%e6%83%85%e6%8c%87%e5%af%bc%e5%ae%8c%e5%85%a8%e4%b8%8d%e4%bc%9ahtml%e5%92%8cphp%e7%9a%84%e5%a4%a7%e9%be%84%e8%82%a5%e5%ae%85%e7%bb%99wp%e7%ab%99%e7%82%b9%e5%8a%a0%e5%8a%9f","status":"publish","type":"post","link":"https:\/\/blogsalt.trollbar.xyz\/index.php\/2023\/03\/491\/","title":{"rendered":"G\u8001\u5e08\u503e\u60c5\u6307\u5bfc\u5b8c\u5168\u4e0d\u4f1aHTML\u548cPHP\u7684\u5927\u9f84\u80a5\u5b85\u7ed9WP\u7ad9\u70b9\u52a0\u529f\u80fd"},"content":{"rendered":"<h3>\u524d\u8a00<\/h3>\n<p>\u4e8b\u60c5\u662f\u8fd9\u6837\u7684\uff1a\u6211\u89c9\u5f97WP\u7684\u8bf4\u8bf4\u662f\u4e2a\u597d\u529f\u80fd\uff0c\u5e94\u8be5\u5927\u529b\u7528\uff0c\u4ece\u6b64\u544a\u522b\u5fae\u535a\u3002\u4f46\u6bcf\u6b21\u53d1\u8868\u90fd\u8981\u8fdb\u540e\u53f0\uff0c\u8fd9\u5b9e\u5728\u662f\u592a\u64cd\u86cb\u4e86\u3002<\/p>\n<p>\u9700\u6c42\u81ea\u7136\u800c\u7136\u5730\u6d6e\u73b0\u4e86\uff01\u6211\u7684\u7b2c\u4e00\u53cd\u5e94\u662f\u501f\u7528\u90ae\u4ef6\u53d1\u6587\u7684\u529f\u80fd\u6765\u5199\u90ae\u4ef6\u53d1\u8868\uff0c\u7136\u540e\u53bbgithub\u7ed9S\u8001\u5e08\u63d0\u4e86issue\u2014\u2014\u4f46\u662fS\u8001\u5e08\u73b0\u5728\u5e94\u8be5\u5df2\u7ecf\u4e0d\u600e\u4e48\u5f00\u53d1argon\u4e3b\u9898\u4e86\u3002<\/p>\n<p>\u7b2c\u4e8c\u53cd\u5e94\u53d8\u5f97\u5408\u7406\u4e86\u5f88\u591a\uff1a\u5728\u8bf4\u8bf4\u9875\u9762\u6dfb\u52a0\u4e00\u4e2a\u4ec5\u7ad9\u957f\u53ef\u89c1\u7684\u8868\u5355\uff0c\u7528\u6765\u5728\u524d\u53f0\u53d1\u8868\u8bf4\u8bf4\u3002\u548c\u8fd9\u4e2a\u4e3b\u610f\u6bd4\u8d77\u6765\uff0c\u7528\u90ae\u4ef6\u53d1\u8bf4\u8bf4\u8fd9\u4ef6\u4e8b\u542c\u8d77\u6765\u7b80\u76f4\u662f\u82cf\u8054\u9057\u98ce\u3002<\/p>\n<p>\u95ee\u9898\u6765\u4e86\uff1a\u8fd9\u4ef6\u4e8b\u542c\u8d77\u6765\u8fd8\u633a\u7b80\u5355\u7684\uff0c\u50cf\u662f\u4e0d\u5230\u4e00\u767e\u884c\u4e1a\u52a1\u4ee3\u7801\u5c31\u80fd\u641e\u5b9a\u7684\u4e8b\u60c5\u3002\u4f46\u662f\u6211\u5b8c\u5168\u6ca1\u6709html\u548cphp\u7ecf\u9a8c\u554a\uff01\u96be\u9053\u8981\u5728\u6211\u5b9d\u8d35\u7684\u79d1\u7814\u65f6\u95f4\u4e2d\u62bd\u7a7a\u4ece\u5934\u5b66<del>\u51a2\u4e2d\u67af\u9aa8<\/del>php\uff1f<\/p>\n<p>\u4e8e\u662fG\u8001\u5e08\u767b\u573a\u4e86\u3002\u8054\u60f3\u5230\u4ee5\u524d\u8ba9GPT\u8001\u5e08\u5e2e\u6211\u6539\u8bba\u6587\u3001\u5199\u5c0f\u8f6e\u5b50\u7684\u7ecf\u5386\uff0c\u6211\u76f8\u4fe1\u5b83\u4e5f\u80fd\u641e\u5b9awordpress\u8fd9\u79cd\u6587\u6863\u548c\u6848\u4f8b\u90fd\u5f88\u4e30\u5bcc\u7684\u5de5\u5177\u3002<\/p>\n<h3>\u9996\u5148\u662f\u641e\u6e05\u695a\u8981\u505a\u4ec0\u4e48<\/h3>\n<p>3\u67081\u53f7\u665a\u4e0a\uff0c\u6211\u8fd8\u5bf9wordpress\u7684\u67b6\u6784\u8fd8\u51e0\u4e4e\u5b8c\u5168\u4e0d\u61c2\u2014\u2014\u610f\u601d\u662f\u8bf4\uff0c\u6211\u6839\u672c\u4e0d\u77e5\u9053argon\u4e3b\u9898\u6dfb\u52a0\u7684\u8fd9\u4e2a\u548c\u201c\u6587\u7ae0\u201d\u903b\u8f91\u4e0a\u5e73\u7ea7\u7684\u201c\u8bf4\u8bf4\u201d\u662f\u4e2a\u4ec0\u4e48\u4e1c\u897f\u3002\u6240\u4ee5\u6211\u7528\u8c26\u5351\u7684\u8bed\u8a00\u5411G\u8001\u5e08\u63cf\u8ff0\u4e86\u6211\u7684\u9700\u6c42\uff1a<\/p>\n<blockquote><p>\u6211\u4f7f\u7528\u7684wordpress\u4e3b\u9898\u589e\u52a0\u4e86\u4e00\u4e2a\u65b0\u7684\uff0c\u4e0e\u201c\u6587\u7ae0\u201d\u6a21\u5757\u903b\u8f91\u4e0a\u5e76\u5217\u7684\u6a21\u5757\uff0c\u5141\u8bb8\u6211\u53d1\u5e03\u7c7b\u4f3c\u63a8\u7279\u7684\uff0c\u65e0\u6807\u9898\u7684\u7b80\u77ed\u6587\u5b57\u3002\u6211\u5e0c\u671b\u7528\u90ae\u4ef6\u7684\u65b9\u5f0f\u53d1\u8868\u8fd9\u4e9b\u6587\u5b57\uff0c\u6211\u8be5\u5982\u4f55\u5f00\u59cb\u5f00\u53d1\u7c7b\u4f3c\u529f\u80fd\uff1f\uff08\u8fd9\u65f6\u6211\u8fd8\u5361\u5728\u7b2c\u4e00\u53cd\u5e94\u90a3\u91cc\uff09<\/p><\/blockquote>\n<p>G\u8001\u5e08\u662f\u8fd9\u4e48\u56de\u7b54\u6211\u7684\uff1a<\/p>\n<blockquote><p>\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u9700\u8981\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5728 WordPress \u540e\u53f0\u65b0\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49 post type\uff08\u6587\u7ae0\u7c7b\u578b\uff09\uff0c\u7528\u6765\u5b58\u50a8\u8fd9\u4e9b\u7b80\u77ed\u7684\u6587\u5b57\u3002\u53ef\u4ee5\u4f7f\u7528\u201cregister_post_type()\u201d\u51fd\u6570\u6765\u521b\u5efa\u81ea\u5b9a\u4e49 post type\u3002<\/li>\n<li>\u7136\u540e\uff0c\u60a8\u9700\u8981\u7f16\u5199\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u90ae\u4ef6\u53d1\u9001\u51fd\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528 WordPress \u63d0\u4f9b\u7684\u201cwp_mail()\u201d\u51fd\u6570\u6765\u53d1\u9001\u90ae\u4ef6\u3002<\/li>\n<li>\u5728\u90ae\u4ef6\u53d1\u9001\u51fd\u6570\u4e2d\uff0c\u60a8\u9700\u8981\u7f16\u5199\u4ee3\u7801\u6765\u83b7\u53d6\u6700\u65b0\u53d1\u5e03\u7684\u7b80\u77ed\u6587\u5b57\u3002\u53ef\u4ee5\u4f7f\u7528 WordPress \u63d0\u4f9b\u7684\u201cget_posts()\u201d\u51fd\u6570\u83b7\u53d6\u81ea\u5b9a\u4e49 post type \u4e2d\u7684\u6700\u65b0\u4e00\u6761\u8bb0\u5f55\u3002<\/li>\n<li>\u60a8\u8fd8\u9700\u8981\u4e3a\u8fd9\u4e2a\u529f\u80fd\u6dfb\u52a0\u4e00\u4e2a\u524d\u7aef\u8868\u5355\uff0c\u8ba9\u7528\u6237\u53ef\u4ee5\u5728\u7f51\u7ad9\u4e0a\u8f93\u5165\u5e76\u63d0\u4ea4\u7b80\u77ed\u6587\u5b57\u3002\u53ef\u4ee5\u4f7f\u7528 WordPress \u63d0\u4f9b\u7684\u201cwp_insert_post()\u201d\u51fd\u6570\u5c06\u7528\u6237\u63d0\u4ea4\u7684\u6587\u5b57\u63d2\u5165\u5230\u81ea\u5b9a\u4e49 post type \u4e2d\u3002<\/li>\n<li>\u6700\u540e\uff0c\u60a8\u9700\u8981\u8bbe\u7f6e\u4e00\u4e2a\u5b9a\u65f6\u4efb\u52a1\u6765\u81ea\u52a8\u53d1\u9001\u90ae\u4ef6\u3002\u53ef\u4ee5\u4f7f\u7528 WordPress \u63d0\u4f9b\u7684\u201cwp_schedule_event()\u201d\u51fd\u6570\u6765\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\uff0c\u5e76\u5c06\u90ae\u4ef6\u53d1\u9001\u51fd\u6570\u4f5c\u4e3a\u56de\u8c03\u51fd\u6570\u4f20\u9012\u7ed9\u5b83\u3002<\/li>\n<\/ol>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u53ea\u662f\u4e00\u4e2a\u5927\u81f4\u7684\u5f00\u53d1\u6d41\u7a0b\uff0c\u5177\u4f53\u5b9e\u73b0\u8fc7\u7a0b\u8fd8\u9700\u8981\u6839\u636e\u60a8\u7684\u9700\u6c42\u8fdb\u884c\u8c03\u6574\u548c\u7ec6\u5316\u3002\u540c\u65f6\uff0c\u4e3a\u4e86\u786e\u4fdd\u5b89\u5168\u6027\u548c\u7a33\u5b9a\u6027\uff0c\u5efa\u8bae\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9075\u5faa WordPress \u7684\u6700\u4f73\u5b9e\u8df5\u548c\u5b89\u5168\u89c4\u8303\u3002<\/p><\/blockquote>\n<p>G\u8001\u5e08\u56de\u7b54\u5f97\u5f88\u7b80\u660e\uff0c\u4f46\u4e00\u4e0b\u5b50\u8ba9\u6211\u660e\u767d\u4e86\u8bf4\u8bf4\u662f\u4e2a\u4ec0\u4e48\u4e1c\u897f\u3002\u4e8e\u662f\u6211\u5f00\u59cb\u5411G\u8001\u5e08\u8be2\u95ee\u5982\u4f55\u5728\u524d\u7aef\u6dfb\u52a0\u4e00\u4e2a\u8868\u5355\u6765\u53d1\u8868\u81ea\u5b9a\u4e49\u7684post type\u3002<\/p>\n<blockquote><p>\u6211\u73b0\u5728\u5df2\u7ecf\u6709\u4e86\u4e00\u4e2a\u521b\u5efa\u597d\u7684post type\uff0c\u53ef\u4ee5\u5728\u540e\u53f0\u6b63\u5e38\u53d1\u8868\u3002\u9488\u5bf9\u6211\u7684\u8fd9\u79cd\u60c5\u51b5\uff0c\u8be6\u7ec6\u5730\u544a\u8bc9\u6211\u5e94\u8be5\u600e\u4e48\u5728\u524d\u53f0\u521b\u5efa\u4e00\u4e2a\u8868\u5355\uff0c\u6765\u53d1\u8868post\u3002<\/p><\/blockquote>\n<p>G\u8001\u5e08\u7684\u56de\u590d\u8fd8\u662f\u5f88\u7b80\u660e\uff0c\u4f3c\u4e4e\u6709\u70b9\u592a\u9ad8\u770b\u6211\u7684php\u5f00\u53d1\u7ecf\u9a8c\u4e86\uff1a<\/p>\n<blockquote><p>\u597d\u7684\uff0c\u63a5\u4e0b\u6765\u7684\u6b65\u9aa4\u5927\u81f4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u6a21\u677f\uff0c\u7528\u4e8e\u5728\u524d\u7aef\u5c55\u793a\u8868\u5355\uff0c\u4f60\u53ef\u4ee5\u5728 WordPress \u7684\u6a21\u677f\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a PHP \u6587\u4ef6\uff0c\u6bd4\u5982\u8bf4 <code>my-form-template.php<\/code>\u3002<\/li>\n<li>\u5728\u8fd9\u4e2a\u6a21\u677f\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u8868\u5355\uff0c\u5305\u542b\u4f60\u60f3\u8981\u7684\u6240\u6709\u5b57\u6bb5\u3002\u6bcf\u4e2a\u5b57\u6bb5\u9700\u8981\u6307\u5b9a\u4e00\u4e2a\u540d\u79f0\u548c\u7c7b\u578b\uff0c\u4ee5\u4fbf\u7a0d\u540e\u5c06\u8868\u5355\u6570\u636e\u4e0e\u81ea\u5b9a\u4e49\u6587\u7ae0\u7c7b\u578b\u7684\u5c5e\u6027\u76f8\u5339\u914d\u3002<\/li>\n<li>\u7f16\u5199\u4e00\u4e2a\u5904\u7406\u8868\u5355\u63d0\u4ea4\u7684 PHP \u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u5728\u4e3b\u9898\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PHP \u6587\u4ef6\uff0c\u6bd4\u5982\u8bf4 <code>submit-form.php<\/code>\u3002\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\uff0c\u4f60\u9700\u8981\u9a8c\u8bc1\u8868\u5355\u6570\u636e\uff0c\u7136\u540e\u4f7f\u7528 <code>wp_insert_post()<\/code> \u51fd\u6570\u521b\u5efa\u4e00\u7bc7\u65b0\u7684\u81ea\u5b9a\u4e49\u6587\u7ae0\u7c7b\u578b\u3002<\/li>\n<li>\u5c06\u8868\u5355\u63d0\u4ea4\u5230 <code>submit-form.php<\/code>\uff0c\u5e76\u4f7f\u7528 AJAX \u5728\u4e0d\u5237\u65b0\u9875\u9762\u7684\u60c5\u51b5\u4e0b\u5904\u7406\u8868\u5355\u63d0\u4ea4\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 jQuery \u6216\u5176\u4ed6 JavaScript \u5e93\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/li>\n<\/ol>\n<p>\u5177\u4f53\u5b9e\u73b0\u65b9\u5f0f\u53ef\u80fd\u4f1a\u56e0\u4e3a\u4f60\u7684\u9700\u6c42\u4e0d\u540c\u800c\u6709\u6240\u4e0d\u540c\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u6df1\u5165\u4e86\u89e3 PHP \u548c WordPress \u5f00\u53d1\u7684\u77e5\u8bc6\u6765\u5b9e\u73b0\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p><\/blockquote>\n<p>\u4e8e\u662f\u6211\u544a\u8bc9G\u8001\u5e08\u6211\u7684\u8fd9\u4e2apost type\u5f88\u7b80\u5355\uff0c\u6ca1\u6709\u6807\u9898\uff0c\u6ca1\u6709\u5206\u7c7b\uff0c\u4e5f\u6ca1\u6709\u6807\u7b7e\uff0c\u8981\u6c42G\u8001\u5e08\u7ed9\u51fa\u5b8c\u6574\u7684\u4f8b\u5b50\u3002G\u8001\u5e08\u7ed9\u6211\u5199\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u81ea\u5b9a\u4e49\u6a21\u677f\uff0c\u4e0d\u8fc7\u662f\u5206\u5f00\u5199\u7684\u3002<\/p>\n<blockquote><p>\u5982\u679c\u4f60\u7684\u81ea\u5b9a\u4e49post type\u975e\u5e38\u7b80\u5355\uff0c\u6ca1\u6709\u4efb\u4f55\u5206\u7c7b\u548c\u6807\u7b7e\uff0c\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528WordPress\u81ea\u5e26\u7684\u9ed8\u8ba4\u6a21\u677fsingle.php\u6765\u663e\u793a\u81ea\u5b9a\u4e49post type\u7684\u5185\u5bb9\u3002\u4e0d\u8fc7\uff0c\u5982\u679c\u4f60\u60f3\u5bf9\u8fd9\u4e2apost type\u7684\u663e\u793a\u6837\u5f0f\u8fdb\u884c\u66f4\u52a0\u7cbe\u7ec6\u7684\u63a7\u5236\uff0c\u53ef\u4ee5\u4f7f\u7528\u81ea\u5b9a\u4e49\u6a21\u677f\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u81ea\u5b9a\u4e49\u6a21\u677f\u7684\u4f8b\u5b50\uff1a<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u5728\u4f60\u7684\u4e3b\u9898\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\uff0c\u547d\u540d\u4e3asingle-{post_type_slug}.php\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684post type slug\u662f\u201cmy_post_type\u201d\uff0c\u90a3\u4e48\u4f60\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u540d\u4e3asingle-my_post_type.php\u7684\u6587\u4ef6\u3002<\/li>\n<li>\u5728\u8fd9\u4e2a\u65b0\u521b\u5efa\u7684\u6587\u4ef6\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u4f5c\u4e3a\u6a21\u677f\u7684\u8d77\u59cb\u70b9\uff1a<\/li>\n<\/ol>\n<pre class=\"code\"> <span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-title function_ invoke__\">get_header<\/span>(); <span class=\"hljs-meta\">?&gt;<\/span>\r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"primary\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"content-area\"<\/span>&gt;<\/span> \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">main<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"main\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"site-main\"<\/span> <span class=\"hljs-attr\">role<\/span>=<span class=\"hljs-string\">\"main\"<\/span>&gt;\r\n<\/span> <span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">while<\/span> ( <span class=\"hljs-title function_ invoke__\">have_posts<\/span>() ) : <span class=\"hljs-title function_ invoke__\">the_post<\/span>(); <span class=\"hljs-meta\">?&gt;<\/span><\/span> \r\n<span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-title function_ invoke__\">get_template_part<\/span>( <span class=\"hljs-string\">'template-parts\/content'<\/span>, <span class=\"hljs-title function_ invoke__\">get_post_type<\/span>() ); <span class=\"hljs-meta\">?&gt;<\/span><\/span> \r\n<span class=\"php\"><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-keyword\">endwhile<\/span>; <span class=\"hljs-comment\">\/\/ End of the loop. ?&gt;\r\n<span class=\"xml\"><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">main<\/span>&gt;<\/span>&lt;!-- #main --&gt; \r\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>&lt;!-- #primary --&gt;\r\n<\/span><span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-title function_ invoke__\">get_sidebar<\/span>(); <span class=\"hljs-meta\">?&gt;<\/span>\r\n<span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-title function_ invoke__\">get_footer<\/span>(); <span class=\"hljs-meta\">?&gt;<\/span><\/span><\/span><\/pre>\n<p>\uff08\u5fc5\u987b\u8981\u63d0\u7684\u662f\uff0cG\u8001\u5e08\u5199\u7684\u4ee3\u7801\u7f29\u8fdb\u5f88\u5b8c\u7f8e\uff0c\u4f46\u590d\u5236\u8fc7\u6765\u4f1a\u6709\u70b9\u95ee\u9898\u2026\u2026\uff09\u8fd9\u4e2a\u6a21\u677f\u7684\u4e3b\u8981\u5185\u5bb9\u662f\u4f7f\u7528get_template_part()\u51fd\u6570\u6765\u8c03\u7528\u53e6\u4e00\u4e2a\u6a21\u677f\u6587\u4ef6template-parts\/content-{post_type_slug}.php\u6765\u663e\u793a\u4f60\u7684\u81ea\u5b9a\u4e49post type\u7684\u5185\u5bb9\u3002\u5728\u8fd9\u4e2a\u51fd\u6570\u4e2d\uff0cget_post_type()\u51fd\u6570\u7528\u4e8e\u83b7\u53d6\u5f53\u524d\u6587\u7ae0\u7684post type slug\u3002<\/p>\n<ol start=\"3\">\n<li>\u521b\u5efa\u53e6\u4e00\u4e2a\u540d\u4e3atemplate-parts\/content-{post_type_slug}.php\u7684\u6587\u4ef6\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ol>\n<pre class=\"code\">&lt;article id=\"post-&lt;?php the_ID(); ?&gt;\" &lt;?php post_class(); ?&gt;&gt;\r\n&lt;header class=\"entry-header\"&gt;\r\n&lt;?php the_title( '&lt;h1 class=\"entry-title\"&gt;', '&lt;\/h1&gt;' ); ?&gt;\r\n&lt;\/header&gt;&lt;!-- .entry-header --&gt;\r\n\r\n&lt;div class=\"entry-content\"&gt;\r\n&lt;?php the_content(); ?&gt;\r\n&lt;\/div&gt;&lt;!-- .entry-content --&gt;\r\n\r\n&lt;\/article&gt;&lt;!-- #post-&lt;?php the_ID(); ?&gt; --&gt;<\/pre>\n<p>\u8fd9\u4e2a\u6a21\u677f\u6587\u4ef6\u663e\u793a\u4e86\u81ea\u5b9a\u4e49post type\u7684\u6807\u9898\u548c\u5185\u5bb9\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u81ea\u5b9a\u4e49\uff0c\u6bd4\u5982\u6dfb\u52a0\u66f4\u591a\u7684\u5143\u6570\u636e\u3001\u7279\u8272\u56fe\u50cf\u7b49\u7b49\u3002<\/p>\n<ol start=\"4\">\n<li>\u4fdd\u5b58\u8fd9\u4e24\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u8bbf\u95ee\u4f60\u7684\u81ea\u5b9a\u4e49post type\u7684\u5355\u4e2a\u9875\u9762\uff0c\u4f60\u5e94\u8be5\u80fd\u591f\u770b\u5230\u4f7f\u7528\u81ea\u5b9a\u4e49\u6a21\u677f\u7684\u6837\u5f0f\u3002<\/li>\n<\/ol>\n<p>\u6ce8\u610f\uff1a\u5982\u679c\u4f60\u7684\u81ea\u5b9a\u4e49post type\u662f\u4f7f\u7528\u4e86\u67d0\u4e2a\u63d2\u4ef6\u6765\u521b\u5efa\u7684\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u8be5\u63d2\u4ef6\u63d0\u4f9b\u7684\u81ea\u5b9a\u4e49\u6a21\u677f\u6587\u4ef6\u540d\u6765\u66ff\u6362\u4e0a\u8ff0\u4f8b\u5b50\u4e2d\u7684\u6587\u4ef6\u540d\u3002<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<blockquote><p>\u8981\u5728\u6a21\u677f\u5e95\u90e8\u6dfb\u52a0\u4e00\u4e2a\u8868\u5355\u4ee5\u4fbf\u7528\u6237\u76f4\u63a5\u53d1\u8868\u65b0\u7684 post\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u5728\u6a21\u677f\u5e95\u90e8\u6dfb\u52a0\u4e00\u4e2a\u8868\u5355\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre class=\"code\"> <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">form<\/span> <span class=\"hljs-attr\">method<\/span>=<span class=\"hljs-string\">\"post\"<\/span>&gt;\r\n<\/span> <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">label<\/span> <span class=\"hljs-attr\">for<\/span>=<span class=\"hljs-string\">\"post-title\"<\/span>&gt;<\/span>\u6807\u9898\uff1a<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">label<\/span>&gt;<\/span> \r\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"text\"<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"post-title\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"post-title\"<\/span> \/&gt;\r\n &lt;<span class=\"hljs-name\">label<\/span> <span class=\"hljs-attr\">for<\/span>=<span class=\"hljs-string\">\"post-content\"<\/span>&gt;\u5185\u5bb9\uff1a&lt;\/<span class=\"hljs-name\">label<\/span>&gt;\r\n &lt;<span class=\"hljs-name\">textarea<\/span> <span class=\"hljs-attr\">name<\/span>=<span class=\"hljs-string\">\"post-content\"<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"post-content\"<\/span>&gt;&lt;\/<span class=\"hljs-name\">textarea<\/span>&gt; \r\n&lt;<span class=\"hljs-name\">button<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"submit\"<\/span>&gt;\u53d1\u5e03\u6587\u7ae0&lt;\/<span class=\"hljs-name\">button<\/span>&gt; &lt;\/<span class=\"hljs-name\">form<\/span>&gt;\r\n<\/span><\/pre>\n<ol start=\"2\">\n<li>\u5728\u8868\u5355\u63d0\u4ea4\u65f6\uff0c\u901a\u8fc7 PHP \u4ee3\u7801\u521b\u5efa\u65b0\u7684 post\u3002\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre class=\"code\"> <span class=\"hljs-comment\">\/\/ \u68c0\u67e5\u8868\u5355\u662f\u5426\u63d0\u4ea4<\/span> \r\n<span class=\"hljs-keyword\">if<\/span> (<span class=\"hljs-variable\">$_SERVER<\/span>[<span class=\"hljs-string\">'REQUEST_METHOD'<\/span>] === <span class=\"hljs-string\">'POST'<\/span>) \r\n{ <span class=\"hljs-comment\">\/\/ \u83b7\u53d6\u8868\u5355\u6570\u636e<\/span> <span class=\"hljs-variable\">$title<\/span> = <span class=\"hljs-variable\">$_POST<\/span>[<span class=\"hljs-string\">'post-title'<\/span>]; <span class=\"hljs-variable\">$content<\/span> = <span class=\"hljs-variable\">$_POST<\/span>[<span class=\"hljs-string\">'post-content'<\/span>]; \r\n<span class=\"hljs-comment\">\/\/ \u521b\u5efa\u65b0\u7684 post<\/span> <span class=\"hljs-variable\">$post_id<\/span> = <span class=\"hljs-title function_ invoke__\">wp_insert_post<\/span>([ \r\n<span class=\"hljs-string\">'post_title'<\/span> =&gt; <span class=\"hljs-variable\">$title<\/span>, \r\n<span class=\"hljs-string\">'post_content'<\/span> =&gt; <span class=\"hljs-variable\">$content<\/span>, \r\n<span class=\"hljs-string\">'post_status'<\/span> =&gt; <span class=\"hljs-string\">'publish'<\/span>, \r\n<span class=\"hljs-string\">'post_type'<\/span> =&gt; <span class=\"hljs-string\">'your_custom_post_type'<\/span>, \r\n\/\/ \u66ff\u6362\u4e3a\u4f60\u7684 post type \u540d\u79f0 \r\n]); \r\n<span class=\"hljs-comment\">\/\/ \u5982\u679c post \u521b\u5efa\u6210\u529f\uff0c\u5219\u663e\u793a\u6210\u529f\u6d88\u606f<\/span> \r\n<span class=\"hljs-keyword\">if<\/span> (<span class=\"hljs-variable\">$post_id<\/span>) { <span class=\"hljs-keyword\">echo<\/span> <span class=\"hljs-string\">'&lt;p&gt;\u6587\u7ae0\u5df2\u53d1\u5e03\uff01&lt;\/p&gt;'<\/span>; \r\n} \r\n}<\/pre>\n<ol start=\"3\">\n<li>\u5728\u8868\u5355\u4e2d\u6dfb\u52a0\u9002\u5f53\u7684\u8f93\u5165\u9a8c\u8bc1\u548c\u8fc7\u6ee4\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u5b89\u5168\u6027\u3002<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u66f4\u6539\u548c\u6269\u5c55\u3002<\/p><\/blockquote>\n<p>G\u8001\u5e08\u8fd8\u4f1a\u6559\u6211\u6ce8\u610f\u5b89\u5168\u6027\u2026\u2026\u6211\u54ed\u6b7b\u3002<\/p>\n<p>\u867d\u7136G\u8001\u5e08\u7684\u6307\u70b9\u5f88\u8be6\u7ec6\uff0c\u4f46\u56e0\u4e3a\u6211\u771f\u7684\u592a\u7d20\u4e86\uff0c\u5bf9html\u5982\u4f55\u5de5\u4f5c\u3001php\u5982\u4f55\u5de5\u4f5c\u3001\u5b83\u4eec\u5982\u4f55\u5728\u4e00\u8d77\u5de5\u4f5c\u6beb\u65e0\u4e86\u89e3\uff0c\u8fd8\u662f\u6298\u817e\u4e86\u597d\u4e00\u4f1a\u513f\u3002\u5728\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u6211\u5b66\u4f1a\u4e86\u53d6\u5de7\u7684\u95ee\u6cd5\u3002<\/p>\n<blockquote><p>\u6211\u7684wordpress\u4e0a\u7ad9\u70b9\u4e0a\u6709\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684post type\uff08\u540d\u4e3a\u201cshuoshuo\u201d\uff09\uff0c\u5b83\u5f88\u7b80\u5355\uff0c\u6ca1\u6709\u4efb\u4f55\u5206\u7c7b\u548c\u6807\u7b7e\uff0c\u4e5f\u4e0d\u9700\u8981\u6807\u9898\u3002\u8fd9\u4e2apost type\u5df2\u7ecf\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u4e86\uff0c\u4e0d\u9700\u8981\u505a\u989d\u5916\u7684\u6539\u52a8\u3002\u6211\u73b0\u5728\u8981\u5728\u4e00\u4e2a\u9875\u9762\u6a21\u677f\u7684\u5e95\u90e8\u6dfb\u52a0\u4e00\u4e2a\u8868\u5355\uff0c\u8ba9\u7ba1\u7406\u5458\u7528\u6237\u80fd\u901a\u8fc7\u8fd9\u4e2a\u8868\u5355\u76f4\u63a5\u5728\u524d\u7aef\u53d1\u8868\u5c5e\u4e8e\u8fd9\u4e2apost type\u7684\u5185\u5bb9\u3002\u544a\u8bc9\u6211\u8be6\u7ec6\u7684\u8fc7\u7a0b\u3002<\/p>\n<p>\u8bf7\u544a\u8bc9\u6211\u5982\u4f55\u6dfb\u52a0\u989d\u5916\u7684\u4ee3\u7801\u4ee5\u9a8c\u8bc1\u7528\u6237\u6743\u9650<\/p>\n<p>\u6211\u6ca1\u6709\u5b66\u4e60\u8fc7php\uff0c\u6240\u4ee5\u8bf7\u4f60\u7ed9\u4f60\u521a\u624d\u53d1\u8868\u7684\u6240\u6709\u4ee3\u7801\u9010\u884c\u52a0\u5165\u6ce8\u91ca\uff0c\u89e3\u91ca\u4e00\u4e0b\u6bcf\u884c\u662f\u5728\u505a\u4ec0\u4e48<\/p><\/blockquote>\n<p>\u7136\u540eG\u8001\u5e08\u5c31\u771f\u7684\u7ed9\u6211\u4e00\u884c\u4e00\u884c\u5199\u4e86\u6ce8\u91ca\u2026\u2026<\/p>\n<blockquote><p>\u5f53\u7136\uff0c\u6211\u5f88\u4e50\u610f\u4e3a\u60a8\u89e3\u91ca\u8fd9\u4e9b\u4ee3\u7801\uff01\u4ee5\u4e0b\u662f\u5b8c\u6574\u4ee3\u7801\u548c\u6bcf\u884c\u7684\u6ce8\u91ca\uff1a<\/p>\n<pre class=\"code\"> <span class=\"hljs-meta\">&lt;?php<\/span> <span class=\"hljs-comment\">\/* Template Name: Custom Shuoshuo *\/<\/span>\u00a0\r\n<span class=\"hljs-comment\">\/\/ \u9a8c\u8bc1\u63d0\u4ea4\u7684\u8868\u5355\u6570\u636e<\/span> \r\n<span class=\"hljs-keyword\">if<\/span> ( <span class=\"hljs-keyword\">isset<\/span>( <span class=\"hljs-variable\">$_POST<\/span>[<span class=\"hljs-string\">'submit_shuoshuo'<\/span>] ) ) {\r\n <span class=\"hljs-comment\">\/\/ \u83b7\u53d6\u8868\u5355\u968f\u673a\u6570\u7801\u5e76\u9a8c\u8bc1\u5b83\u662f\u5426\u5339\u914d<\/span> \r\n<span class=\"hljs-keyword\">if<\/span> ( <span class=\"hljs-title function_ invoke__\">wp_verify_nonce<\/span>( <span class=\"hljs-variable\">$_POST<\/span>[<span class=\"hljs-string\">'shuoshuo_nonce'<\/span>], <span class=\"hljs-string\">'shuoshuo_nonce_action'<\/span> ) ) {\r\n <span class=\"hljs-comment\">\/\/ \u83b7\u53d6\u8868\u5355\u4e2d\u7684\u201cshuoshuo\u201d\u5e16\u5b50\u7c7b\u578b\u7684\u5185\u5bb9<\/span> \r\n<span class=\"hljs-variable\">$shuoshuo_content<\/span> = <span class=\"hljs-variable\">$_POST<\/span>[<span class=\"hljs-string\">'shuoshuo_content'<\/span>]; \r\n<span class=\"hljs-comment\">\/\/ \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u201cshuoshuo\u201d\u5e16\u5b50\u7c7b\u578b<\/span> \r\n<span class=\"hljs-variable\">$new_post<\/span> = <span class=\"hljs-keyword\">array<\/span>(\r\n <span class=\"hljs-string\">'post_content'<\/span> =&gt; <span class=\"hljs-variable\">$shuoshuo_content<\/span>, \r\n<span class=\"hljs-string\">'post_status'<\/span> =&gt; <span class=\"hljs-string\">'publish'<\/span>, \r\n<span class=\"hljs-string\">'post_type'<\/span> =&gt; <span class=\"hljs-string\">'shuoshuo'<\/span> ); \r\n <span class=\"hljs-comment\">\/\/ \u5c06\u65b0\u5e16\u5b50\u63d2\u5165\u6570\u636e\u5e93\u4e2d\u5e76\u83b7\u53d6\u5176ID<\/span> \r\n<span class=\"hljs-variable\">$post_id<\/span> = <span class=\"hljs-title function_ invoke__\">wp_insert_post<\/span>( <span class=\"hljs-variable\">$new_post<\/span> ); \r\n<span class=\"hljs-comment\">\/\/ \u5982\u679c\u63d2\u5165\u6210\u529f\uff0c\u5219\u91cd\u5b9a\u5411\u5230\u65b0\u5e16\u5b50\u7684URL<\/span> \r\n<span class=\"hljs-keyword\">if<\/span> ( <span class=\"hljs-variable\">$post_id<\/span> ) { \r\n<span class=\"hljs-title function_ invoke__\">wp_redirect<\/span>( <span class=\"hljs-title function_ invoke__\">get_permalink<\/span>( <span class=\"hljs-variable\">$post_id<\/span> ) );\r\n <span class=\"hljs-keyword\">exit<\/span>; \r\n} } }\r\n<span class=\"hljs-comment\">\/\/ \u5f00\u59cb\u8f93\u51fa\u9875\u9762\u5185\u5bb9<\/span> \r\n<span class=\"hljs-title function_ invoke__\">get_header<\/span>(); <span class=\"hljs-meta\">?&gt;\r\n&lt;div id=<span class=\"hljs-string\">\"primary\"<\/span> <span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span>=\"<span class=\"hljs-title\">content<\/span>-<span class=\"hljs-title\">area<\/span>\"&gt; \r\n&lt;<span class=\"hljs-title\">main<\/span> <span class=\"hljs-title\">id<\/span>=\"<span class=\"hljs-title\">main<\/span>\" <span class=\"hljs-title\">class<\/span>=\"<span class=\"hljs-title\">site<\/span>-<span class=\"hljs-title\">main<\/span>\" <span class=\"hljs-title\">role<\/span>=\"<span class=\"hljs-title\">main<\/span>\"&gt; \r\n&lt;?<span class=\"hljs-title\">php<\/span> \r\n\/\/ \u5f00\u59cb<span class=\"hljs-title\">WordPress<\/span>\u5faa\u73af\uff0c\u5faa\u73af\u51fa\u6240\u6709\u201c<span class=\"hljs-title\">shuoshuo<\/span>\u201d\u5e16\u5b50\u7c7b\u578b\u7684\u6587\u7ae0 \r\n<span class=\"hljs-title\">while<\/span> ( <span class=\"hljs-title\">have_posts<\/span>() ) : <span class=\"hljs-title\">the_post<\/span>(); \r\n\/\/ \u83b7\u53d6\u5f53\u524d\u6587\u7ae0\u7684\u6807\u9898\u548c\u5185\u5bb9 \r\n$<span class=\"hljs-title\">title<\/span> = <span class=\"hljs-title\">get_the_title<\/span>(); \r\n$<span class=\"hljs-title\">content<\/span> = <span class=\"hljs-title\">get_the_content<\/span>(); \r\n\/\/ \u8f93\u51fa\u6807\u9898\u548c\u5185\u5bb9 \r\n<span class=\"hljs-title\">echo<\/span> '&lt;<span class=\"hljs-title\">h1<\/span>&gt;' . $<span class=\"hljs-title\">title<\/span> . '&lt;\/<span class=\"hljs-title\">h1<\/span>&gt;'; \r\n<span class=\"hljs-title\">echo<\/span> '&lt;<span class=\"hljs-title\">div<\/span>&gt;' . $<span class=\"hljs-title\">content<\/span> . '&lt;\/<span class=\"hljs-title\">div<\/span>&gt;'; \r\n<span class=\"hljs-title\">endwhile<\/span>; \r\n\/\/ \u7ed3\u675f\u5faa\u73af ?&gt; \r\n&lt;?<span class=\"hljs-title\">php<\/span> \r\n\/\/ \u8f93\u51fa\u4e00\u4e2a\u5305\u542b\u6587\u672c\u533a\u57df\u548c\u63d0\u4ea4\u6309\u94ae\u7684\u8868\u5355 \r\n?&gt; \r\n&lt;<span class=\"hljs-title\">form<\/span> <span class=\"hljs-title\">method<\/span>=\"<span class=\"hljs-title\">post<\/span>\"&gt;\r\n &lt;<span class=\"hljs-title\">textarea<\/span> <span class=\"hljs-title\">name<\/span>=\"<span class=\"hljs-title\">shuoshuo_content<\/span>\"&gt;&lt;\/<span class=\"hljs-title\">textarea<\/span>&gt;\r\n&lt;<span class=\"hljs-title\">br<\/span>&gt; \r\n&lt;<span class=\"hljs-title\">input<\/span> <span class=\"hljs-title\">type<\/span>=\"<span class=\"hljs-title\">submit<\/span>\" <span class=\"hljs-title\">name<\/span>=\"<span class=\"hljs-title\">submit_shuoshuo<\/span>\" <span class=\"hljs-title\">value<\/span>=\"\u53d1\u8868\"&gt; \r\n&lt;?<span class=\"hljs-title\">php<\/span> <span class=\"hljs-title\">wp_nonce_field<\/span>( '<span class=\"hljs-title\">shuoshuo_nonce_action<\/span>', '<span class=\"hljs-title\">shuoshuo_nonce<\/span>' ); ?&gt; \r\n&lt;\/<span class=\"hljs-title\">form<\/span>&gt; \r\n&lt;\/<span class=\"hljs-title\">main<\/span>&gt;&lt;!-- #<span class=\"hljs-title\">main<\/span> --&gt; \r\n&lt;\/<span class=\"hljs-title\">div<\/span>&gt;&lt;!-- #<span class=\"hljs-title\">primary<\/span> --&gt; \r\n&lt;?<span class=\"hljs-title\">php<\/span> <span class=\"hljs-title\">get_footer<\/span>(); ?&gt;<\/span><\/span><\/pre>\n<p>\u5e0c\u671b\u8fd9\u4e9b\u6ce8\u91ca\u5bf9\u60a8\u6709\u5e2e\u52a9\uff01\u5982\u679c\u60a8\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u8bf7\u968f\u65f6\u95ee\u6211\u3002<\/p><\/blockquote>\n<p>\u73b0\u5728\u56de\u8fc7\u5934\u6765\u770b\u770b\u7684\u8bdd\uff0c\u8fd9\u4e2a\u81ea\u5b9a\u4e49\u6a21\u677f\u8fde\u8f93\u51fa\u8bc4\u8bba\u7684\u529f\u80fd\u90fd\u5199\u4e86\uff0c\u591a\u5c11\u6709\u70b9\u8d85\u51fa\u4e86\u6211\u7684\u9700\u6c42\u2026\u2026<\/p>\n<p>anyway\uff0c\u6839\u636eG\u8001\u5e08\u7684\u6307\u793a\uff0c\u6211\u6210\u529f\u5728\u9875\u9762\u5e95\u7aef\u52a0\u4e86\u4e00\u4e2a\uff08\u53ea\u6709\u7ba1\u7406\u5458\u53ef\u89c1\u7684\uff09\u8868\u5355\u548c\u63d0\u4ea4\u6309\u94ae\uff0c\u53ef\u4ee5\u7528\u6765\u63d0\u4ea4post\u3002\u4f46\u662f\u5b83\u592a\u4e11\u4e86\uff01\u5149\u79c3\u79c3\u7684\u6587\u672c\u6846\u548c\u6309\u94ae\uff0c\u7b80\u76f4\u76ee\u4e0d\u5fcd\u89c6\u3002<\/p>\n<p>\u867d\u7136\u8fd9\u4e9b\u5185\u5bb9\u53ea\u6709\u6211\u81ea\u5df1\u80fd\u770b\u5230\uff0c\u4f46\u6211\u8fd8\u662f\u51b3\u5fc3\u5957\u7528argon\u4e3b\u9898\u7684\u98ce\u683c\u5c06\u5176\u7f8e\u5316\u3002\u5f53\u65f6\u5df2\u7ecf\u662f\u534a\u591c\u5feb\u4e24\u70b9\uff0c\u73b0\u5728\u60f3\u60f3\u6211\u90a3\u4e2a\u65f6\u5019\u5c31\u5e94\u8be5\u53bb\u7761\u89c9\u7684\u3002<\/p>\n<h3>\u4e3a\u4e86\u7f8e\u5316\uff0c\u4ece\u5934\u8ba9G\u8001\u5e08\u6559\u6211html<\/h3>\n<p>\u6211\u60f3\u4e86\u4e00\u4e0b\uff0c\u611f\u89c9\u5982\u679c\u8981\u7f8e\u5316\u7684\u8bdd\uff0c\u4e0d\u61c2\u4e00\u70b9html\u6050\u6015\u8fd8\u662f\u5f88\u96be\u3002\u4e8e\u662f\u6211\u5f00\u59cb\u8ba9G\u8001\u5e08\u4e00\u884c\u4e00\u884c\u7ed9\u6211\u8bb2\u3002<\/p>\n<blockquote><p>&lt;\/div&gt;&lt;!&#8211; .entry-content &#8211;&gt;\u8fd9\u53e5\u662f\u5728\u505a\u4ec0\u4e48\uff1f<\/p><\/blockquote>\n<blockquote><p>\u8fd9\u53e5\u8bdd\u662f\u4e00\u4e2a HTML \u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u8bb0 &#8220;entry-content&#8221; \u7c7b\u7684 div \u5143\u7d20\u7684\u7ed3\u675f\u4f4d\u7f6e\uff0c\u4e5f\u5c31\u662f\u5176\u5185\u5bb9\u7684\u7ed3\u675f\u4f4d\u7f6e\u3002\u5728\u8fd9\u4e2a\u7279\u5b9a\u7684\u4ee3\u7801\u6bb5\u4e2d\uff0c\u8fd9\u4e2a div \u5143\u7d20\u5305\u88f9\u4e86 WordPress \u5faa\u73af\u4e2d\u6bcf\u7bc7\u6587\u7ae0\u7684\u5185\u5bb9\uff0c\u5373\u6807\u9898\u548c\u6b63\u6587\u3002\u901a\u8fc7\u8fd9\u4e2a\u6ce8\u91ca\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u66f4\u8f7b\u677e\u5730\u9605\u8bfb\u548c\u7406\u89e3 HTML \u4ee3\u7801\u7ed3\u6784\u3002<\/p><\/blockquote>\n<blockquote><p>&lt;\/article&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;\u8fd9\u53e5\u662f\u5728\u505a\u4ec0\u4e48<\/p><\/blockquote>\n<blockquote><p>\u8fd9\u53e5\u8bdd\u662f\u4e00\u4e2a HTML \u6ce8\u91ca\uff0c\u7528\u4e8e\u6807\u8bb0 &#8220;article&#8221; \u5143\u7d20\u7684\u7ed3\u675f\u4f4d\u7f6e\u3002\u5728\u8fd9\u4e2a\u7279\u5b9a\u7684\u4ee3\u7801\u6bb5\u4e2d\uff0c&#8221;article&#8221; \u5143\u7d20\u7528\u4e8e\u5305\u88f9 WordPress \u5faa\u73af\u4e2d\u6bcf\u7bc7\u6587\u7ae0\u7684\u6574\u4e2a\u5185\u5bb9\uff0c\u5305\u62ec\u6807\u9898\u3001\u6b63\u6587\u3001\u8bc4\u8bba\u7b49\u3002\u901a\u8fc7\u8fd9\u4e2a\u6ce8\u91ca\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u66f4\u8f7b\u677e\u5730\u9605\u8bfb\u548c\u7406\u89e3 HTML \u4ee3\u7801\u7ed3\u6784\u3002\u5728\u8fd9\u4e2a\u6ce8\u91ca\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 PHP \u7684 <code>the_ID()<\/code> \u51fd\u6570\uff0c\u5c06\u5f53\u524d\u6587\u7ae0\u7684 ID \u8f93\u51fa\u5230 HTML \u6ce8\u91ca\u4e2d\uff0c\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5728\u8c03\u8bd5\u548c\u6392\u67e5\u95ee\u9898\u65f6\u66f4\u8f7b\u677e\u5730\u5b9a\u4f4d\u5230\u7279\u5b9a\u6587\u7ae0\u7684 HTML \u4ee3\u7801\u3002<\/p><\/blockquote>\n<blockquote><p>&lt;main id=&#8221;main&#8221; class=&#8221;site-main&#8221; role=&#8221;main&#8221;&gt;\u8fd9\u53e5\u662f\u5728\u505a\u4ec0\u4e48<\/p><\/blockquote>\n<blockquote><p>\u8fd9\u53e5\u8bdd\u662f\u4e00\u4e2a HTML \u5143\u7d20\uff0c\u5b9a\u4e49\u4e86\u4e00\u4e2a\u4e3b\u8981\u7684\u9875\u9762\u533a\u57df\uff0c\u5176 ID \u4e3a &#8220;main&#8221;\uff0c\u7c7b\u540d\u4e3a &#8220;site-main&#8221;\uff0c\u5e76\u4e14\u5177\u6709 &#8220;main&#8221; \u7684\u89d2\u8272\u3002\u5728 WordPress \u4e3b\u9898\u4e2d\uff0c&#8221;main&#8221; \u5143\u7d20\u901a\u5e38\u7528\u4e8e\u5305\u88f9\u6587\u7ae0\u5217\u8868\u3001\u641c\u7d22\u7ed3\u679c\u3001\u5b58\u6863\u7b49\u9875\u9762\u7684\u4e3b\u8981\u5185\u5bb9\u533a\u57df\u3002\u5b83\u662f\u8bed\u4e49\u5316\u7684 HTML \u5143\u7d20\u4e4b\u4e00\uff0c\u6709\u52a9\u4e8e\u5f00\u53d1\u8005\u7f16\u5199\u53ef\u8bbf\u95ee\u548c\u53ef\u7ef4\u62a4\u7684\u4ee3\u7801\u3002\u5728\u8fd9\u4e2a\u7279\u5b9a\u7684\u4ee3\u7801\u6bb5\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 WordPress \u63d0\u4f9b\u7684 &#8220;main&#8221; \u5143\u7d20\u6837\u5f0f\u548c\u76f8\u5173\u51fd\u6570\uff0c\u4ee5\u786e\u4fdd\u8fd9\u4e2a\u5143\u7d20\u53ef\u4ee5\u6b63\u786e\u5730\u4e0e\u4e3b\u9898\u7684\u6837\u5f0f\u548c\u529f\u80fd\u76f8\u96c6\u6210\u3002<\/p><\/blockquote>\n<blockquote><p>\u8bd5\u7740\u4e3a\u6211\u89e3\u91ca\u8fd9\u53e5\u4ee3\u7801\uff1a&lt;h3 class=&#8221;text-black&#8221;&gt;&lt;?php _e(&#8216;\u81ea\u8bf4\u81ea\u8bdd&#8217;, &#8216;argon&#8217;);?&gt;&lt;\/h3&gt;\u3002\u5176\u4e2dargon\u662f\u4e3b\u9898\u7684\u540d\u79f0\uff0c\u53ef\u80fd\u6307\u5b9a\u4e86\u67d0\u79cd\u6587\u672c\u6837\u5f0f<\/p><\/blockquote>\n<blockquote><p>\u8fd9\u6bb5\u4ee3\u7801\u521b\u5efa\u4e86\u4e00\u4e2a\u5305\u542b\u6587\u672c &#8220;\u81ea\u8bf4\u81ea\u8bdd&#8221; \u7684\u6807\u9898\u6807\u7b7e &#8220;h3&#8243;\uff0c\u5e76\u4e14\u7ed9\u5b83\u6dfb\u52a0\u4e86\u4e00\u4e2a\u7c7b\u540d &#8220;text-black&#8221;\u3002\u5728\u8fd9\u4e2a\u7279\u5b9a\u7684\u4ee3\u7801\u6bb5\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 PHP \u7684 <code>_e()<\/code> \u51fd\u6570\u6765\u8f93\u51fa &#8220;\u81ea\u8bf4\u81ea\u8bdd&#8221; \u8fd9\u4e2a\u6587\u672c\u5b57\u7b26\u4e32\uff0c\u5e76\u4e14\u6307\u5b9a\u4e86 &#8220;argon&#8221; \u4f5c\u4e3a\u7ffb\u8bd1\u57df\u540d\u3002\u7ffb\u8bd1\u57df\u540d\u7528\u4e8e\u5728 WordPress \u4e3b\u9898\u6216\u63d2\u4ef6\u4e2d\u5bf9\u6587\u672c\u8fdb\u884c\u56fd\u9645\u5316\u548c\u672c\u5730\u5316\u5904\u7406\u3002\u8fd9\u91cc &#8220;argon&#8221; \u53ef\u80fd\u662f\u4e3b\u9898\u540d\u79f0\uff0c\u4e5f\u53ef\u80fd\u662f\u5728\u4e3b\u9898\u4e2d\u6307\u5b9a\u7684\u67d0\u4e2a\u7ffb\u8bd1\u57df\u540d\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u4e3b\u9898\u7684\u5b9e\u73b0\u65b9\u5f0f\u3002\u6837\u5f0f\u540d\u79f0 &#8220;text-black&#8221; \u53ef\u80fd\u662f\u5b9a\u4e49\u5728\u4e3b\u9898\u7684 CSS \u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u7c7b\u540d\uff0c\u7528\u4e8e\u6307\u5b9a\u6807\u9898\u6587\u672c\u7684\u989c\u8272\u6837\u5f0f\u3002<\/p><\/blockquote>\n<blockquote><p>\u6211\u53ef\u4ee5\u7528\u76f8\u4f3c\u7684\u65b9\u6cd5\u6765\u8f93\u51fa\u4e0a\u6587\u4e2d\u201csubmit\u201d\u8fd9\u4e2a\u6309\u94ae\u91cc\u9762\u7684\u6587\u672c\u5417\uff1f<\/p><\/blockquote>\n<blockquote><p>\u662f\u7684\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c\u7684\u65b9\u5f0f\u6765\u8f93\u51fa &#8220;submit&#8221; \u6309\u94ae\u91cc\u9762\u7684\u6587\u672c\u3002\u5728\u63d0\u4ea4\u6309\u94ae\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 <code>value<\/code> \u5c5e\u6027\u6765\u6307\u5b9a\u6309\u94ae\u4e0a\u7684\u6587\u672c\u3002\u56e0\u6b64\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 PHP \u7684 <code>_e()<\/code> \u51fd\u6570\u6216\u8005 <code>__()<\/code> \u51fd\u6570\u6765\u8f93\u51fa\u6587\u672c\uff0c\u5e76\u5c06\u5176\u8d4b\u503c\u7ed9 <code>value<\/code> \u5c5e\u6027\u3002\u4f8b\u5982\uff1a<\/p>\n<pre class=\"code\"> &lt;input type=\"submit\" name=\"submit\" value=\"&lt;?php _e('\u63d0\u4ea4', 'argon'); ?&gt;\"&gt;<\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u4f1a\u5728 &#8220;submit&#8221; \u6309\u94ae\u4e0a\u8f93\u51fa &#8220;\u63d0\u4ea4&#8221; \u8fd9\u4e2a\u6587\u672c\u5b57\u7b26\u4e32\uff0c\u5e76\u4e14\u4f7f\u7528 &#8220;argon&#8221; \u4f5c\u4e3a\u7ffb\u8bd1\u57df\u540d\u3002\u5982\u679c\u4e3b\u9898\u4f7f\u7528\u4e86\u4e0d\u540c\u7684\u7ffb\u8bd1\u57df\u540d\uff0c\u60a8\u9700\u8981\u76f8\u5e94\u5730\u66f4\u6539\u7ffb\u8bd1\u57df\u540d\u53c2\u6570\u3002<\/p><\/blockquote>\n<p>\u6211\u5c31\u8fd9\u4e48\u8ba9G\u8001\u5e08\u7ed9\u6211\u8bb2\u4e86\u534a\u5c0f\u65f6html\u2026\u2026\u4e0d\u5f97\u4e0d\u8bf4\uff0cG\u8001\u5e08\u8bb2\u5f97\u6bd4CSDN\u5f3a\u591a\u4e86\u2026\u2026<\/p>\n<p>\u4e8e\u662f\u6211\u5982\u6cd5\u70ae\u5236\uff0c\u53c8\u628a\u7559\u8a00\u677f\u9875\u9762\u7684\u4ee3\u7801\u590d\u5236\u51fa\u6765\u8ba9G\u8001\u5e08\u7ed9\u6211\u8bb2\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u8fd8\u6bd4\u8f83\u957f\uff0c\u5c31\u4e0d\u5168\u90fd\u5199\u51fa\u6765\u4e86\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u6700\u540e\u5728G\u8001\u5e08\u7684\u6307\u5bfc\u4e0b\uff0c\u6211\u6210\u529f\u7ed9\u8bf4\u8bf4\u5e95\u7aef\u52a0\u4e86\u4e00\u4e2a\u8868\u5355\uff0c\u8fd8\u641e\u4e86\u4e00\u4e2a\u65b0\u7684\u9875\u9762\u6765\u5355\u72ec\u53d1\u8bf4\u8bf4\u3002\u6574\u4e2a\u8fc7\u7a0b\u5927\u6982\u7528\u4e86\u2026\u20268\u5c0f\u65f6\uff1f\u5bf9\u4e8e0\u57fa\u7840html\u6765\u8bf4\u5e94\u8be5\u7b97\u662f\u5f88\u597d\u7684\u8001\u5e08\u4e86\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>G\u8001\u5e08\uff0c\u6211\u7684\u8d85\u4eba<\/h3>\n<p>\u5728\u8fc7\u7a0b\u4e2d\uff0c\u6211\u8fd8\u8ba9G\u8001\u5e08\u5199\u4e86\u4e00\u4e2a\u641c\u7d22\u8def\u5f84\u4e0b\u6240\u6709\u6587\u672c\u6587\u4ef6\u5185\u5bb9\u7684\u5c0f\u7a0b\u5e8f\u3002<\/p>\n<blockquote><p>\u7ed9\u6211\u7528python\u5199\u4e00\u4e2aGUI\uff0c\u53ef\u4ee5\u5728\u4e00\u4e2a\u6307\u5b9a\u6587\u4ef6\u5939\u4e0b\u7684\u6240\u6709\u6587\u672c\u6587\u4ef6\uff08\u5305\u542b.php\uff0c.md\u7b49\u53ef\u4ee5\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u7684\u6587\u4ef6\uff09\u7684\u5185\u5bb9\u4e2d\u67e5\u627e\u5b57\u7b26\u4e32\uff0c\u5e76\u8f93\u51fa\u5b83\u5728\u54ea\u4e9b\u6587\u4ef6\u4e2d\u5b58\u5728\u3002<\/p><\/blockquote>\n<p>\u4ee3\u7801\u6709\u70b9\u957f\uff08\u56e0\u4e3a\u4ee3\u7801\u5757\u6392\u7248\u6709\u70b9\u95ee\u9898\uff09\u5c31\u4e0d\u653e\u4e86\uff0c\u4f46\u662fG\u8001\u5e08\u5199\u7684\u4e1c\u897f\u867d\u7136\u4e0d\u597d\u770b\u5374\u771f\u7684\u76f4\u63a5\u5c31\u80fd\u7528\u2026\u2026\u5c31\u8fd9\u4e48\u4e2a\u5c0f\u7a0b\u5e8f\uff0c\u5199\u80af\u5b9a\u662f\u4e0d\u96be\uff0c\u4f46\u662f\u600e\u4e48\u8bf4\u4e5f\u8981\u5199\u4e2a\u5341\u5206\u949f\u2014\u2014\u5927\u90e8\u5206\u65f6\u95f4\u90fd\u7528\u6765\u67e5\u5e73\u65f6\u4e0d\u5e38\u7528\u7684\u8f6e\u5b50\u4e86\uff01\u4f46G\u8001\u5e082\u5206\u949f\u5c31\u80fd\u5199\u51fa\u4e00\u4e2a\u80fd\u7528\u7684\u4e1c\u897f\uff0c\u5b9e\u5728\u662f\u592a\u68d2\u4e86\u3002<\/p>\n<p>\u6700\u540e\u628aG\u8001\u5e08\uff08\u548c\u6211\u7684\uff0c\u4f46\u4e3b\u8981\u662fG\u8001\u5e08\u7684\uff09\u7684\u6210\u679c\u653e\u5728\u4e0b\u9762\uff0c\u4e07\u4e00\u6709\u4eba\u770b\u5230\u5462\uff1a<\/p>\n<p><a href=\"https:\/\/blogsalt.trollbar.xyz\/wp-content\/uploads\/2023\/03\/\u8bf4\u8bf4\u9875\u9762\u6a21\u677f.zip\">\u8bf4\u8bf4\u9875\u9762\u6a21\u677f<\/a><\/p>\n<p>\u4e00\u4e2a\u662f\u91cd\u5199\u4e86\u7684\u8bf4\u8bf4\u9875\u9762\u6a21\u677f\uff0c\u53e6\u4e00\u4e2a\u662f\u53bb\u6389\u4e86sidebar\u7684\u7eaf\u51c0\u53d1po\u9875\u9762\u3002<\/p>\n<p>\u603b\u7ed3\u4e00\u4e0b\u7684\u8bdd\uff1a<\/p>\n<ol>\n<li>G\u8001\u5e08\u5bf9\u5165\u95e8\u7ea7\u95ee\u9898\u7684\u6307\u5bfc\u662f\u6781\u5176\u7cbe\u51c6\u4e14\u5168\u9762\u7684\uff0c\u8d8a\u521d\u7ea7\u7684\u95ee\u9898G\u8001\u5e08\u7b54\u5f97\u8d8a\u597d\u3002\u5bf9\u4e8e\u6709\u4e00\u70b9\u7ecf\u9a8c\u7684\u4eba\u6765\u8bf4\uff0c\u4f7f\u7528G\u8001\u5e08\u540e\u65b0\u5de5\u5177\u7684\u5b66\u4e60\u66f2\u7ebf\u4f1a\u9661\u5ced\u5f97\u5413\u4eba\u3002<\/li>\n<li>G\u8001\u5e08\u7684\u7406\u89e3\u80fd\u529b\u975e\u5e38\u60ca\u4eba\u3002\u5728\u8c03\u8bd5\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u591a\u6b21\u628a\u5199\u597d\u7684\u9875\u9762\u6a21\u677f\u76f4\u63a5\u6254\u7ed9G\u8001\u5e08\uff0c\u6709\u65f6\u6254\u5230\u4e00\u4e2a\u65b0\u7684\u5bf9\u8bdd\u91cc\uff0cG\u8001\u5e08\u90fd\u80fd\u8fc5\u901f\u5206\u6790\u51fa\u8fd9\u4e2a\u9875\u9762\u662f\u5e72\u4ec0\u4e48\u7684\u3002<\/li>\n<li>G\u8001\u5e08\u7684\u6ce8\u91ca\u80fd\u529b\u4e5f\u5f88\u5389\u5bb3\uff0c\u5f53\u6211\u628a\u4e00\u6bb5\u5168\u65b0\u7684\u3001\u5939\u6742\u4e86\u4e00\u4e9b\u81ea\u5b9a\u4e49style\u7684html\u4ee3\u7801\u6254\u7ed9G\u8001\u5e08\uff0cG\u8001\u5e08\u4e5f\u80fd\u8fc5\u901f\u7406\u89e3\u8fd9\u662f\u5728\u5e72\u4ec0\u4e48\u3002<\/li>\n<li>G\u8001\u5e08\u751a\u81f3\u80fd\u505a\u51fa\u731c\u6d4b\uff0c\u6309\u7167\u6211\u63d0\u4f9b\u7684html\u6837\u5f0f\u7ed9\u6211\u5199\u6a21\u677f\uff0c\u8fd9\u4e2a\u5c31\u5f88\u5413\u4eba\u2026<\/li>\n<\/ol>\n<p>\u603b\u4e4b\uff0cG\u8001\u5e08\u76ee\u524d\u5df2\u7ecf\u6210\u4e3aCSDN\u7684\u8d85\u7ea7\u4e0a\u4f4d\u66ff\u4ee3\uff0c\u5e9f\u8bdd-80%\uff0c\u6548\u7387+200%\uff0c\u800c\u4e14\u6781\u5176\u5584\u89e3\u4eba\u610f\u3002\u6211\u73b0\u5728\u6df1\u6df1\u5730\u4e3a\u51e0\u4e2a\u6708\u524d\u8bd5\u56fe\u548cG\u8001\u5e08\u6587\u7231\u800c\u611f\u5230\u6127\u759a\uff0c\u9762\u5bf9\u8fd9\u4e48\u597d\u7684\u8001\u5e08\u6211\u5c45\u7136\u7b2c\u4e00\u53cd\u5e94\u662f\u51b2\u7740\u4e0b\u4e09\u8def\u53bb\u7684\uff0c\u7b80\u76f4\u662f\u884c\u8d70\u7684\u9e21\u5df4\u2026\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8ba9GPT\u8001\u5e08\u6559\u6211\u4ece\u96f6\u5f00\u59cb\u5b66html\uff0c\u7ed9\u7ad9\u70b9\u6dfb\u52a0\u5728\u524d\u7aef\u63d0\u4ea4\u8bf4\u8bf4\u7684\u529f\u80fd\u3002<\/p>\n","protected":false},"author":1,"featured_media":492,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[173],"tags":[22],"class_list":["post-491","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-g"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/blogsalt.trollbar.xyz\/wp-content\/uploads\/2023\/03\/a_mordern_style_robot_teaching_a_middle-aged_man_to_write_c_34cc22ac-d353-41d2-9ad3-6ed2bd4f1a5d.png","_links":{"self":[{"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/posts\/491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=491"}],"version-history":[{"count":11,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/posts\/491\/revisions"}],"predecessor-version":[{"id":504,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/posts\/491\/revisions\/504"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/media\/492"}],"wp:attachment":[{"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogsalt.trollbar.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}