{"id":15,"date":"2023-10-26T03:30:00","date_gmt":"2023-10-26T00:00:00","guid":{"rendered":"https:\/\/shahroodi.com\/?code_tutorial=wordpress-add-custom-post-type"},"modified":"2023-10-26T03:30:00","modified_gmt":"2023-10-26T00:00:00","slug":"wordpress-add-custom-post-type","status":"publish","type":"code_tutorial","link":"https:\/\/shahroodi.com\/?code_tutorial=wordpress-add-custom-post-type","title":{"rendered":"WordPress: Add Custom Post Type"},"content":{"rendered":"<p>When building a custom WordPress theme, you often need to manage content that doesn&#8217;t fit into the standard &#8216;Post&#8217; or &#8216;Page&#8217; structure. This is where Custom Post Types (CPTs) come in. They allow you to define your own content types with their own set of fields and templates. Here&#8217;s the basic code to register a new &#8216;Portfolio Item&#8217; post type, which you can place in your theme&#8217;s functions.php file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A foundational snippet for creating a new custom post type in your WordPress theme&#8217;s functions.php file. This is the first step to building custom content structures.<\/p>\n","protected":false},"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","class_list":["post-15","code_tutorial","type-code_tutorial","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shahroodi.com\/index.php?rest_route=\/wp\/v2\/code_tutorial\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shahroodi.com\/index.php?rest_route=\/wp\/v2\/code_tutorial"}],"about":[{"href":"https:\/\/shahroodi.com\/index.php?rest_route=\/wp\/v2\/types\/code_tutorial"}],"replies":[{"embeddable":true,"href":"https:\/\/shahroodi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15"}],"wp:attachment":[{"href":"https:\/\/shahroodi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}