{"id":55729,"date":"2024-10-10T05:36:13","date_gmt":"2024-10-09T21:36:13","guid":{"rendered":"https:\/\/server.hk\/cnblog\/55729\/"},"modified":"2024-10-10T05:36:13","modified_gmt":"2024-10-09T21:36:13","slug":"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9awordpress-%e8%87%aa%e5%ae%9a%e7%be%a9%e4%b8%bb%e9%a1%8c","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/55729\/","title":{"rendered":"WordPress \u6559\u7a0b\uff1aWordPress \u81ea\u5b9a\u7fa9\u4e3b\u984c"},"content":{"rendered":"<h1 id=\"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9awordpress-%e8%87%aa%e5%ae%9a%e7%be%a9%e4%b8%bb%e9%a1%8c-dZYWvdBYSp\">WordPress \u6559\u7a0b\uff1aWordPress \u81ea\u5b9a\u7fa9\u4e3b\u984c<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u4e16\u754c\u4e2d\uff0cWordPress \u662f\u6700\u53d7\u6b61\u8fce\u7684\u5167\u5bb9\u7ba1\u7406\u7cfb\u7d71\u4e4b\u4e00\u3002\u7121\u8ad6\u662f\u500b\u4eba\u535a\u5ba2\u9084\u662f\u4f01\u696d\u7db2\u7ad9\uff0cWordPress \u90fd\u63d0\u4f9b\u4e86\u9748\u6d3b\u6027\u548c\u53ef\u64f4\u5c55\u6027\u3002\u81ea\u5b9a\u7fa9\u4e3b\u984c\u662f\u63d0\u5347\u7db2\u7ad9\u5916\u89c0\u548c\u529f\u80fd\u7684\u91cd\u8981\u65b9\u5f0f\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u5982\u4f55\u5275\u5efa\u548c\u81ea\u5b9a\u7fa9 WordPress \u4e3b\u984c\uff0c\u5e6b\u52a9\u60a8\u6253\u9020\u7368\u7279\u7684\u7db2\u7ad9\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-wordpress-%e4%b8%bb%e9%a1%8c%ef%bc%9f-dZYWvdBYSp\">\u4ec0\u9ebc\u662f WordPress \u4e3b\u984c\uff1f<\/h2>\n<p>WordPress \u4e3b\u984c\u662f\u4e00\u7d44\u6587\u4ef6\uff0c\u5b9a\u7fa9\u4e86\u7db2\u7ad9\u7684\u5916\u89c0\u548c\u529f\u80fd\u3002\u4e3b\u984c\u5305\u542b\u4e86\u6a23\u5f0f\u8868\u3001\u6a21\u677f\u6587\u4ef6\u548c\u5176\u4ed6\u8cc7\u6e90\uff0c\u9019\u4e9b\u6587\u4ef6\u5171\u540c\u6c7a\u5b9a\u4e86\u7db2\u7ad9\u7684\u5e03\u5c40\u3001\u984f\u8272\u3001\u5b57\u9ad4\u548c\u5176\u4ed6\u8996\u89ba\u5143\u7d20\u3002\u901a\u904e\u81ea\u5b9a\u7fa9\u4e3b\u984c\uff0c\u60a8\u53ef\u4ee5\u5b8c\u5168\u63a7\u5236\u7db2\u7ad9\u7684\u5916\u89c0\uff0c\u4e26\u6839\u64da\u9700\u6c42\u9032\u884c\u8abf\u6574\u3002<\/p>\n<h2 id=\"%e5%89%b5%e5%bb%ba%e8%87%aa%e5%ae%9a%e7%be%a9%e4%b8%bb%e9%a1%8c%e7%9a%84%e6%ad%a5%e9%a9%9f-dZYWvdBYSp\">\u5275\u5efa\u81ea\u5b9a\u7fa9\u4e3b\u984c\u7684\u6b65\u9a5f<\/h2>\n<h3 id=\"1-%e6%ba%96%e5%82%99%e5%b7%a5%e4%bd%9c-dZYWvdBYSp\">1. \u6e96\u5099\u5de5\u4f5c<\/h3>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u5df2\u7d93\u5b89\u88dd\u4e86 WordPress\u3002\u63a5\u4e0b\u4f86\uff0c\u60a8\u53ef\u4ee5\u5728\u672c\u5730\u74b0\u5883\u6216\u4f3a\u670d\u5668\u4e0a\u5275\u5efa\u4e00\u500b\u65b0\u7684\u4e3b\u984c\u6587\u4ef6\u593e\u3002\u901a\u5e38\uff0c\u4e3b\u984c\u6587\u4ef6\u593e\u4f4d\u65bc <code>wp-content\/themes\/<\/code> \u76ee\u9304\u4e0b\u3002<\/p>\n<h3 id=\"2-%e5%89%b5%e5%bb%ba%e5%9f%ba%e6%9c%ac%e6%96%87%e4%bb%b6-dZYWvdBYSp\">2. \u5275\u5efa\u57fa\u672c\u6587\u4ef6<\/h3>\n<p>\u6bcf\u500b WordPress \u4e3b\u984c\u81f3\u5c11\u9700\u8981\u5169\u500b\u6587\u4ef6\uff1a<code>style.css<\/code> \u548c <code>index.php<\/code>\u3002<\/p>\n<pre><code>\/* style.css *\/\nTheme Name: My Custom Theme\nTheme URI: http:\/\/example.com\nAuthor: Your Name\nAuthor URI: http:\/\/example.com\nDescription: A custom theme for WordPress.\nVersion: 1.0\nLicense: GNU General Public License v2 or later\nLicense URI: http:\/\/www.gnu.org\/licenses\/gpl-2.0.html\nTags: custom, theme\n*\/\n\n\/* \u9019\u88e1\u53ef\u4ee5\u6dfb\u52a0\u81ea\u5b9a\u7fa9\u6a23\u5f0f *\/\nbody {\n    background-color: #f0f0f0;\n}\n<\/code><\/pre>\n<pre><code>&lt;!-- index.php --&gt;\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;title&gt;&lt;?php wp_title(); ?&gt;&lt;\/title&gt;\n    &lt;link rel=\"stylesheet\" href=\"&lt;?php bloginfo('stylesheet_url'); ?&gt;\"&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h1&gt;&lt;?php bloginfo('name'); ?&gt;&lt;\/h1&gt;\n    &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;\n        &lt;h2&gt;&lt;a href=\"&lt;?php the_permalink(); ?&gt;\"&gt;&lt;?php the_title(); ?&gt;&lt;\/a&gt;&lt;\/h2&gt;\n        &lt;p&gt;&lt;?php the_excerpt(); ?&gt;&lt;\/p&gt;\n    &lt;?php endwhile; endif; ?&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<h3 id=\"3-%e6%b7%bb%e5%8a%a0%e5%8a%9f%e8%83%bd-dZYWvdBYSp\">3. \u6dfb\u52a0\u529f\u80fd<\/h3>\n<p>\u8981\u4f7f\u4e3b\u984c\u66f4\u5177\u529f\u80fd\u6027\uff0c\u60a8\u53ef\u4ee5\u5275\u5efa\u4e00\u500b <code>functions.php<\/code> \u6587\u4ef6\u3002\u5728\u9019\u500b\u6587\u4ef6\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6dfb\u52a0\u81ea\u5b9a\u7fa9\u529f\u80fd\uff0c\u4f8b\u5982\u8a3b\u518a\u83dc\u55ae\u3001\u6dfb\u52a0\u5c0f\u5de5\u5177\u5340\u57df\u7b49\u3002<\/p>\n<pre><code>&lt;?php\nfunction my_custom_theme_setup() {\n    add_theme_support('title-tag');\n    register_nav_menus(array(\n        'primary' =&gt; __('Primary Menu', 'my_custom_theme'),\n    ));\n}\nadd_action('after_setup_theme', 'my_custom_theme_setup');\n?&gt;\n<\/code><\/pre>\n<h3 id=\"4-%e6%b8%ac%e8%a9%a6%e5%92%8c%e8%aa%bf%e6%95%b4-dZYWvdBYSp\">4. \u6e2c\u8a66\u548c\u8abf\u6574<\/h3>\n<p>\u5b8c\u6210\u4e3b\u984c\u7684\u57fa\u672c\u8a2d\u7f6e\u5f8c\uff0c\u60a8\u53ef\u4ee5\u5728 WordPress \u5f8c\u53f0\u555f\u7528\u60a8\u7684\u4e3b\u984c\u3002\u9032\u5165 <code>\u5916\u89c0 &gt; \u4e3b\u984c<\/code>\uff0c\u627e\u5230\u60a8\u7684\u81ea\u5b9a\u7fa9\u4e3b\u984c\u4e26\u555f\u7528\u3002\u96a8\u5f8c\uff0c\u60a8\u53ef\u4ee5\u5728\u524d\u7aef\u67e5\u770b\u6548\u679c\uff0c\u4e26\u6839\u64da\u9700\u8981\u9032\u884c\u8abf\u6574\u3002<\/p>\n<h2 id=\"%e6%9c%80%e4%bd%b3%e5%af%a6%e8%b8%90-dZYWvdBYSp\">\u6700\u4f73\u5be6\u8e10<\/h2>\n<ul>\n<li>\u4fdd\u6301\u4ee3\u78bc\u6574\u6f54\uff0c\u9075\u5faa WordPress \u7684\u7de8\u78bc\u6a19\u6e96\u3002<\/li>\n<li>\u4f7f\u7528\u5b50\u4e3b\u984c\u9032\u884c\u4fee\u6539\uff0c\u4ee5\u4fbf\u65bc\u672a\u4f86\u7684\u66f4\u65b0\u3002<\/li>\n<li>\u5b9a\u671f\u5099\u4efd\u60a8\u7684\u4e3b\u984c\u548c\u6578\u64da\u3002<\/li>\n<li>\u6e2c\u8a66\u4e3b\u984c\u5728\u4e0d\u540c\u8a2d\u5099\u548c\u700f\u89bd\u5668\u4e0a\u7684\u517c\u5bb9\u6027\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-dZYWvdBYSp\">\u7e3d\u7d50<\/h2>\n<p>\u81ea\u5b9a\u7fa9 WordPress \u4e3b\u984c\u662f\u4e00\u500b\u6709\u8da3\u4e14\u5177\u6311\u6230\u6027\u7684\u904e\u7a0b\uff0c\u80fd\u5920\u5e6b\u52a9\u60a8\u5275\u5efa\u7368\u7279\u7684\u7db2\u7ad9\u3002\u901a\u904e\u9075\u5faa\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u8a2d\u8a08\u51fa\u7b26\u5408\u81ea\u5df1\u9700\u6c42\u7684\u4e3b\u984c\uff0c\u4e26\u63d0\u5347\u7db2\u7ad9\u7684\u6574\u9ad4\u8cea\u91cf\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u4e3b\u6a5f\u652f\u6301\u4f86\u904b\u884c\u60a8\u7684 WordPress \u7db2\u7ad9\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u7db2\u7ad9\u63d0\u4f9b\u5f37\u5927\u7684\u6027\u80fd\u548c\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22 WordPress \u81ea\u5b9a\u7fa9\u4e3b\u984c\u7684\u8a73\u7d30\u6559\u7a0b\uff0c\u5b78\u7fd2\u5982\u4f55\u5275\u5efa\u7368\u7279\u4e14\u529f\u80fd\u5f37\u5927\u7684\u7db2\u7ad9\uff0c\u63d0\u5347\u60a8\u7684\u7db2\u9801\u8a2d\u8a08\u6280\u80fd\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-55729","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/55729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=55729"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/55729\/revisions"}],"predecessor-version":[{"id":55730,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/55729\/revisions\/55730"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=55729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=55729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=55729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}