{"id":12221,"date":"2021-03-05T00:00:00","date_gmt":"2021-03-04T16:00:00","guid":{"rendered":"https:\/\/fgchen.com\/wpedu2\/2021\/03\/05\/wordpress-theme-development-tutorial-step-by-step-vegibit\/"},"modified":"2026-03-30T14:38:58","modified_gmt":"2026-03-30T06:38:58","slug":"wordpress-theme-development-tutorial-step-by-step-vegibit","status":"publish","type":"post","link":"https:\/\/fgchen.com\/wpedu\/2021\/03\/wordpress-theme-development-tutorial-step-by-step-vegibit\/","title":{"rendered":"\u5f9e\u96f6\u958b\u59cb\u5efa\u7acbWordPress\u4e3b\u984c"},"content":{"rendered":"<blockquote>This is going to be a fun tutorial where we inspect how to create your own WordPress Theme from scratch. In fact, we&#8217;ll begin with absolutely zero files and zero lines of code. The only way to understand how WordPress Themes work, is to really jump in at a low level and do every single\u2026<\/blockquote>\n\n\u5167\u5bb9\u51fa\u8655: <em><a href=\"https:\/\/vegibit.com\/wordpress-theme-development-tutorial-step-by-step\/\">WordPress Theme Development Tutorial Step By Step \u2013 Vegibit<\/a><\/em>\n\n&nbsp;\n\n<h2 id=\"mcetoc_1f01aapha0\">Step 1: Create a folder to hold your theme files<\/h2>\n\n\u5728wp-content\u4e0b\u7684theme\u5efa\u7acb\u4e00\u500b\u65b0\u8cc7\u6599\u593e\uff0c\u4f8b\u5982\uff0cmytheme\n\n<h2 id=\"mcetoc_1f01ad0le1\">Step 2: Create style.css and index.php in your theme folder<\/h2>\n\n\u5efa\u7acb <a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/main-stylesheet-style-css\/\">style.css<\/a>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"css\">\/*\nTheme Name: mytheme\nAuthor: Wells\nAuthor URI: https:\/\/fgchen.com\nVersion: 1.0\n *\/<\/pre>\n\n<h4><\/h4>\n\n<h4>\u5efa\u7acb index.php<\/h4>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;h1&gt;Custom Theme!&lt;\/h1&gt;\n<\/pre>\n\n&nbsp;\n\n<h2 id=\"mcetoc_1f01ahtsd2\">Step 3: Activate your theme from the WordPress Dashboard<\/h2>\n\n&nbsp;\n\n<h2 id=\"mcetoc_1f01aiatd3\">Step 4: Add Code to Output The Post Title and Post Text<\/h2>\n\nindex.php\u4fee\u6539\u6210\u5982\u4e0b\u7684\u7a0b\u5f0f\u78bc\uff1a\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php\n \nif ( have_posts() ) :\n  while ( have_posts() ) : the_post(); ?&gt;\n \n        &lt;h2&gt;&lt;?php the_title() ?&gt;&lt;\/h2&gt;\n    &lt;?php the_content() ?&gt;\n  \n  &lt;?php endwhile;\n \nelse :\n  echo '&lt;p&gt;There are no posts!&lt;\/p&gt;';\n \nendif;\n \n?&gt;<\/pre>\n\n&nbsp;\n\n<h2 id=\"mcetoc_1f01aof8g4\">Step 5: Add a Link To Each Post \u70ba\u6bcf\u4e00\u5247\u8cbc\u6587\u52a0\u4e0a\u8d85\u9023\u7d50(\u6253\u958b\u6bcf\u4e00\u5247\u8cbc\u6587)<\/h2>\n\n&nbsp;\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php\n \nif ( have_posts() ) :\n  while ( have_posts() ) : the_post(); ?&gt;\n \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;?php the_content() ?&gt;\n  \n  &lt;?php endwhile;\n \nelse :\n  echo '&lt;p&gt;There are no posts!&lt;\/p&gt;';\n \nendif;\n \n?&gt;<\/pre>\n\n&nbsp;\n\n<h2 id=\"mcetoc_1f01arho65\">Step 6: Add a Header and Footer To The Custom Theme<\/h2>\n\n&nbsp;\n\n&nbsp;","protected":false},"excerpt":{"rendered":"<p>This is going to be a fun tutorial where &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[266],"tags":[],"class_list":["post-12221","post","type-post","status-publish","format-standard","hentry","category-266"],"_links":{"self":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/comments?post=12221"}],"version-history":[{"count":1,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12221\/revisions"}],"predecessor-version":[{"id":13500,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/posts\/12221\/revisions\/13500"}],"wp:attachment":[{"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/media?parent=12221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/categories?post=12221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fgchen.com\/wpedu\/wp-json\/wp\/v2\/tags?post=12221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}