{"id":27585,"date":"2021-03-02T11:21:36","date_gmt":"2021-03-02T17:21:36","guid":{"rendered":"https:\/\/www.hostgator.com\/blog\/?p=27585"},"modified":"2021-08-20T12:43:11","modified_gmt":"2021-08-20T17:43:11","slug":"wordpress-custom-post-types","status":"publish","type":"post","link":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/","title":{"rendered":"How to use WordPress custom post types to make editing a breeze for your clients"},"content":{"rendered":"\n<p>While WordPress\u2019s available posts and pages cover most needs for static websites and blogs, custom post types can transform your clients\u2019 site into a <a href=\"https:\/\/www.hostgator.com\/blog\/benefits-wordpress-cms\/\">more robust content management system<\/a> (CMS).&nbsp;<\/p>\n\n\n\n<p>Additionally, the combination of block templates and custom post types (CPT) make it easier than ever for your clients to update their own sites, without f**king up your design.<\/p>\n\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-a-custom-post-type-cpt\">What is a custom post type (CPT)?<\/h2>\n\n\n\n<p>Think about the parts that make up a standard post on WordPress. Now, imagine that all those components were customizable and could be expanded to fit any type of content. That\u2019s how custom post types work. From its earliest days, WordPress already had a few post types built in, including posts, pages, attachments, and menus, but version 2.9 opened up this structure up to everyone allowing a greater level of customization to the platform.<\/p>\n\n\n<div class=\"hgrp\"><h4>You might like&#8230;<\/h4><ul><li><span class=\"prod-icon\"><a href=\"https:\/\/www.hostgator.com\/web-hosting\" data-element-location=\"body.post_content.related_prod_block\" data-element-type=\"button\" data-element-label=\"shared_hosting\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/shared-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/shared-150x150.png 150w, https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/shared-300x300.png 300w, https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/shared.png 500w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><\/span><a href=\"https:\/\/www.hostgator.com\/web-hosting\" class=\"hgrp-link\" data-element-location=\"body.post_content.related_prod_block\" data-element-type=\"link\" data-element-label=\"shared_hosting\">Shared Hosting<\/a><\/li><li><span class=\"prod-icon\"><a href=\"https:\/\/www.hostgator.com\/managed-wordpress-hosting\" data-element-location=\"body.post_content.related_prod_block\" data-element-type=\"button\" data-element-label=\"wordpress_hosting\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/wp-hosting-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/wp-hosting-150x150.png 150w, https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/wp-hosting-300x300.png 300w, https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2020\/11\/wp-hosting.png 500w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/a><\/span><a href=\"https:\/\/www.hostgator.com\/managed-wordpress-hosting\" class=\"hgrp-link\" data-element-location=\"body.post_content.related_prod_block\" data-element-type=\"link\" data-element-label=\"wordpress_hosting\">WordPress Hosting<\/a><\/li><\/ul><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-are-custom-post-types-cpt-the-right-move-for-your-project\">Are custom post types (CPT) the right move for your project?<\/h2>\n\n\n\n<p>Of course, custom post types are not always the best solution for every clients\u2019 request. Often a content addition can be resolved by creating a landing page, using a custom page template, installing a plugin, or sprucing up an existing archive template, but other times you need a more robust solution.&nbsp;<\/p>\n\n\n\n<p>Ask yourself this:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Is the content repeatable?<\/strong> A CPT is overkill for a one-off request and should only be used when a similar type of content needs to be repeated indefinitely.<\/li><li><strong>Can the content be templatized?<\/strong> CPT is best for content which is going to be displaying the same variable dataset.<\/li><li><strong>Do you want a<\/strong> <strong>dynamic and dedicated browsing experience for this content?<\/strong> You\u2019ll often hear clients ask for a page where users can browse the latest from only this specific content type, as well as use the words 'library,'\u009d 'reference list,'\u009d 'calendar,'\u009d or 'portfolio'\u009d in describing their needs.<\/li><\/ul>\n\n\n\n<p>If you answered yes to any of these, then CPT may be the best tool to keep that content looking tidy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-examples-of-wordpress-custom-post-types-cpt-in-the-wild\">3 Examples of WordPress Custom Post Types (CPT) in the Wild<\/h2>\n\n\n\n<p>WordPress custom post types are everywhere. And when I say everywhere, I mean an incredibly large majority of WordPress plugins are built using CPT, ergo a large amount of WP sites have some form of CPT in place whether they know it or not.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-jetpack-built-by-automattic\">1. Jetpack, built by Automattic<\/h3>\n\n\n\n<p>The settings are toggled off by default, but the Jetpack plugin comes with a Portfolio and Testimonial CPT built-in. Check it out in action on the <a href=\"https:\/\/demo.siteorigin.com\/unwind\/photography-portfolio\/\" target=\"_blank\" rel=\"noopener noreferrer\">Unwind theme demo<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/S0WcNHvGzBBPriH2dGEGfdpPYRCUh5Kj3KrWab9jeZDMLh1NUmgNheKA5gFR9KvGXffkHpraEQLo45oExFaBdbDs7mEO4TBVp5DFd-SomvDAxlnt-R_Ew21EQfiWpzyiq9xcFLVn\" alt=\"jetpack portfolio and testimonial custom post type\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-woocommerce\">2. WooCommerce<\/h3>\n\n\n\n<p>When you install WooCommerce on your site, your entire store is run off of a Products CPT. <a href=\"https:\/\/orangeamps.com\/global-shop\/\" target=\"_blank\" rel=\"noopener noreferrer\">Orange Amps<\/a> runs their shop through this plugin.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/y_0g-QUCqwbmeSWbfYyNG7PrPfuBR140SDqhacz6P4_UDsgSVOATX9oKwPgm4kSPWRIsePljVFtx9p_rqPMsCexz4L4KC8q3Xy69vYaBXNZ8A3XOA-1MYq66NeD1lyqkRDt5nH0C\" alt=\"woocommerce products custom post type\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-hostgator-s-resource-library\">3. HostGator\u2019s Resource Library<\/h3>\n\n\n\n<p>Our own <a href=\"https:\/\/www.hostgator.com\/blog\/resources\/\">Resource Library<\/a> at HostGator was built using a Resources CPT and offers a dedicated browsing experience for long-living educational content, like email courses, ebooks and webinars.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/81lNl0GCLAp3kqSKRI9yqaxLN37ki56JhicyQNn52tdihjKutMVKhRcM3vT5lZCIxEz5AsqdPiVOG_TiLxvh9zh9xZ_E437R_S2d86lbl0IuMo3LvnxatqdEmUSR5B12U3xmTn0z\" alt=\"hostgator blog example wordpress custom post type\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-build-your-own-wordpress-custom-post-type-plugin\">How to Build Your Own WordPress Custom Post Type Plugin<\/h2>\n\n\n\n<p>For the sake of this tutorial, let\u2019s say you\u2019ve got a client who livestreams lore-heavy Dungeons &amp; Dragons campaigns and they\u2019re looking for a way to create a library of recurring game characters. They also want to enable players and guest players to go in and update their own character pages.&nbsp;<\/p>\n\n\n\n<p>This is a great opportunity to use CPT because the content is <strong>repeatable,<\/strong> can be <strong>templatized<\/strong>, and would benefit from a <strong>dynamic and dedicated browsing experience<\/strong>.<\/p>\n\n\n\n<p>I\u2019m going to walk you through building your own WordPress CPT, from brainstorm to build.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-before-you-do-anything-else-make-a-plan-for-your-cpt\">Before You Do Anything Else, Make a Plan for Your CPT<\/h2>\n\n\n\n<p>You know what is sick? Knowing what the hell you\u2019re doing before getting elbows deep in building it, realizing you didn\u2019t bring a compass.<\/p>\n\n\n\n<p>Each CPT can come with its own browsing experience, including its own taxonomies and archive landing pages and singular pages. You can inherit a lot from your existing theme set-up or create an entirely new browsing experience for your CPT. In this tutorial, we\u2019ll be focusing on setting up a basic CPT with a custom single page block template.<\/p>\n\n\n\n<p>Before you code, you\u2019ve got to plan. There are three things to consider during the planning phase when creating a CPT:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What data will you be using?<\/li><li>What should it look like?<\/li><li>Which WordPress blocks will you use?<\/li><\/ul>\n\n\n\n<p>Let\u2019s dig in.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-what-s-the-data\">1. What\u2019s the data?<\/h3>\n\n\n\n<p>Talk to your client to get an idea about what information they are wanting to display. For this example of the Dungeons &amp; Dragons character library, I want to display the following information from character sheets:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Character\u2019s Name<\/li><li>Player\u2019s Name<\/li><li>Level<\/li><li>Race<\/li><li>Class<\/li><li>Character Sketch<\/li><li>Backstory<\/li><li>Alignment<\/li><li>Background<\/li><li>Age<\/li><li>Height<\/li><li>Weight<\/li><li>Eye Color<\/li><li>Hair Color<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-what-should-it-look-like\">2. What should it look like?&nbsp;<\/h3>\n\n\n\n<p>Wireframe the pages so you know where and how the data will need to be pulled into the front-end. It doesn\u2019t need to be complicated, just a basic page layout for where this information will show up.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/l62Yr-4F_Nthw84MlAtck9zLLlTnR8CbY8jv0Fhl8IUJmbbNtRnvzhnflKYDhdmLb6H5h1VLgG__WFmXMyrNdu1YRnUWBqf4zyEFnuv6VbrEecv1FoKWGzWoJfOEl1Xb9yyjA1yg\" alt=\"wireframe for custom post type in wordpress\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-which-blocks-are-we-using\">3. Which blocks are we using?<\/h3>\n\n\n\n<p>In November 2020, WordPress released Block Patterns and Block Templates, which makes CPT page building easier than ever.<\/p>\n\n\n\n<p>Many of the features of a standard post, e.g. post title and content, are available by default through the custom post type.&nbsp;<\/p>\n\n\n\n<p>Other information can be added to our template via an array of block variables. For this example, I\u2019m sticking with <a href=\"https:\/\/core.wp-a2z.org\/2019\/01\/12\/blocks-catalog\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress core blocks<\/a>, but you can use blocks from any plugin\u2019s block library.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Character\u2019s Name =&gt; post_title<\/li><li>Player\u2019s Name =&gt; author<\/li><li>Nested columns =&gt; core\/columns<ul><li>Level =&gt; core\/paragraph<\/li><li>Race =&gt; core\/paragraph<\/li><li>Class =&gt; core\/paragraph<\/li><\/ul><\/li><li>Nested columns =&gt; core\/columns<ul><li>Character Sketch =&gt; core\/image<\/li><li>Traits =&gt; core\/heading<ul><li>Alignment =&gt; core\/paragraph<\/li><li>Background =&gt; core\/paragraph<\/li><li>Age =&gt; core\/paragraph<\/li><li>Height =&gt; core\/paragraph<\/li><li>Weight =&gt; core\/paragraph<\/li><li>Eye Color =&gt; core\/paragraph<\/li><li>Hair Color =&gt; core\/paragraph<\/li><\/ul><\/li><\/ul><\/li><li>Backstory =&gt; core\/paragraph<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-code-your-wordpress-cpt-step-by-step\">How to Code Your WordPress CPT, Step by Step<\/h2>\n\n\n\n<p>CPTs can be implemented as part of your custom theme or as a plugin. For this tutorial, I decided to focus on building it out as a standalone plugin, as that will be most useful to those using pre-built or child themes and those who have a <a href=\"https:\/\/www.hostgator.com\/blog\/how-build-wordpress-themes\/\">custom built WordPress theme<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-1-bootstrap-your-plugin\">Step 1: Bootstrap your Plugin<\/h3>\n\n\n\n<p>Starting with a boilerplate plugin takes the guesswork out of getting everything set up in an object-oriented framework. This will save you a lot of time and help keep your code organized.<\/p>\n\n\n\n<p>My boilerplate of choice, <a href=\"https:\/\/wppb.me\/\" target=\"_blank\" rel=\"noopener noreferrer\">WPPB.me<\/a>, is super easy-to-use and very clearly documented.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/X8FHIZ92XwoEzcEAIxcWR7ojcj7Xo_qPTbyj491qwKzkYIxjtv-3LOrkzvWJiHWRMKVBdRcKaV8FPRRLujlbHj2rJFUzX1fFd2ufl2Ixl-eUUHecJaZZsTIxKXWRBKutnPY-gwDl\" alt=\"wordpress plugin boilerplate generator\"\/><\/figure>\n\n\n\n<p>If I was to build out our Dungeons &amp; Dragons CPT using WPPB.me, here are the steps I\u2019d follow:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Complete the form. I\u2019ll call this plugin 'The Tavern'\u009d because it\u2019s where all the characters are gathered under one roof, and I\u2019ll set the slug to <code>tavern<\/code> to keep things easy. Fill out the rest of the form fields with your information and click 'Build Plugin'\u009d to download.<\/li><li>After unzipping the file, you\u2019ll want to go into the folder and open <em>tavern.php<\/em>, and update the plugin description on <code>line 18<\/code>. This is the description that shows up on the Plugins screen.&nbsp;<\/li><li>Upload the file into the <code>wp-content\/plugins<\/code> directory on your test environment, you should see The Tavern in the Plugins section in the WP admin dashboard.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-2-register-your-custom-post-type\">Step 2: Register your Custom Post Type<\/h3>\n\n\n\n<p>The next thing you\u2019ll want to do is set up your Characters custom post type.<\/p>\n\n\n\n<p><strong>Get into the Admin File<\/strong><\/p>\n\n\n\n<p>Open <code>tavern\/admin\/class-tavern-admin.php<\/code>.<\/p>\n\n\n\n<p>This is the file where you put any functions that can be called on the admin side. The first function we\u2019ll be setting up is the<em> <\/em><code>register_post_type<\/code> function. You can find full details of this function and its various attributes on the <a rel=\"noopener noreferrer\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_post_type\/\" target=\"_blank\">WordPress.org Code Reference<\/a>.&nbsp;<\/p>\n\n\n\n<p><strong>Define the Function<\/strong><\/p>\n\n\n\n<p>This will be your wrapper for the <code>register_post_type<\/code> function, which you\u2019ll call in the <code>init<\/code> action. You can name it whatever you want (using underscores), but I prefer using something descriptive, like <code>register_characters_cpt<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * Register the characters custom post type\n *\n * @since    1.0.0\n *\/\npublic function register_characters_cpt() {\n     \/** start coding here **\/\n}<\/code><\/pre>\n\n\n\n<p><strong>Labels<\/strong><\/p>\n\n\n\n<p>The <code>$labels<\/code> variable tells WordPress which words you are wanting to replace in the common post editing experience. You\u2019ll notice that I am using the <a rel=\"noopener noreferrer\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/__\/\" target=\"_blank\"><code>__()<\/code><\/a> and <a rel=\"noopener noreferrer\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/_x\/\" target=\"_blank\"><code>_x()<\/code><\/a> functions to input text into these labels. This is to keep the plugin open for localization (l10n), which will make translation easier in the future.<\/p>\n\n\n\n<p>[code snippet 2.2]<\/p>\n\n\n\n<amp-fit-text layout=\"fixed-height\" min-font-size=\"6\" max-font-size=\"72\" height=\"80\"><pre class=\"wp-block-code\"><code>$labels = array(\n    'name'                  =&gt; _x( 'Characters', 'Post Type General Name', 'tavern' ),\n    'singular_name'         =&gt; _x( 'Character', 'Post Type Singular Name', 'tavern' ),\n    'menu_name'             =&gt; __( 'The Tavern', 'tavern' ),\n    'name_admin_bar'        =&gt; __( 'Character Sheets', 'tavern' ),\n    'archives'              =&gt; __( 'Our Characters', 'tavern' ),\n    'attributes'            =&gt; __( 'Character Attributes', 'tavern' ),\n    'parent_item_colon'     =&gt; __( 'Parent Character:', 'tavern' ),\n    'all_items'             =&gt; __( 'All Characters', 'tavern' ),\n    'add_new_item'          =&gt; __( 'Add New Character', 'tavern' ),\n    'add_new'               =&gt; __( 'Add New', 'tavern' ),\n    'new_item'              =&gt; __( 'New Character', 'tavern' ),\n    'edit_item'             =&gt; __( 'Edit Character', 'tavern' ),\n    'update_item'           =&gt; __( 'Update Character', 'tavern' ),\n    'view_item'             =&gt; __( 'View Character', 'tavern' ),\n    'view_items'            =&gt; __( 'View Characters', 'tavern' ),\n    'search_items'          =&gt; __( 'Search Characters', 'tavern' ),\n    'not_found'             =&gt; __( 'Not found', 'tavern' ),\n    'not_found_in_trash'    =&gt; __( 'Not found in Trash', 'tavern' ),\n    'featured_image'        =&gt; __( 'Character Sketch', 'tavern' ),\n    'set_featured_image'    =&gt; __( 'Set character sketch', 'tavern' ),\n    'remove_featured_image' =&gt; __( 'Remove character sketch', 'tavern' ),\n    'use_featured_image'    =&gt; __( 'Use as character sketch', 'tavern' ),\n    'insert_into_item'      =&gt; __( 'Insert into character sheet', 'tavern' ),\n    'uploaded_to_this_item' =&gt; __( 'Uploaded to this character sheet', 'tavern' ),\n    'items_list'            =&gt; __( 'Character list', 'tavern' ),\n    'items_list_navigation' =&gt; __( 'Character list navigation', 'tavern' ),\n    'filter_items_list'     =&gt; __( 'Filter character list', 'tavern' ),\n);<\/code><\/pre><\/amp-fit-text>\n\n\n\n<p><strong>Arguments<\/strong><\/p>\n\n\n\n<p>The <code>$args<\/code> variable tells WordPress how to set up the custom post type and how it will interact with the admin and front-end experiences on the site. Again, the <a rel=\"noopener noreferrer\" href=\"https:\/\/developer.wordpress.org\/reference\/functions\/register_post_type\/\" target=\"_blank\">Code Reference<\/a> is a great resource for better understanding what each of these attributes do.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$args = array(\n    'label'                 =&gt; __( 'Character', 'tavern' ),\n    'description'           =&gt; __( 'Stats and Lore about our Characters', 'tavern' ),\n    'labels'                =&gt; $labels,\n    'supports'              =&gt; array( 'title', 'author', 'editor', 'thumbnail', 'comments', 'trackbacks' ),\n    'hierarchical'          =&gt; false,\n    'public'                =&gt; true,\n    'show_ui'               =&gt; true,\n    'show_in_menu'          =&gt; true,\n    'menu_position'         =&gt; 5,\n    'menu_icon'             =&gt; 'dashicons-beer',\n    'show_in_admin_bar'     =&gt; true,\n    'show_in_nav_menus'     =&gt; true,\n    'can_export'            =&gt; true,\n    'has_archive'           =&gt; true,\n    'exclude_from_search'   =&gt; false,\n    'publicly_queryable'    =&gt; true,\n    'capability_type'       =&gt; 'post',\n    'show_in_rest'\t    =&gt; true,\n    'rest_base'\t\t    =&gt; 'tavern-api',\n    'rest_controller_class' =&gt; 'WP_REST_Posts_Controller',\n);<\/code><\/pre>\n\n\n\n<p><strong>Putting it All Together<\/strong><\/p>\n\n\n\n<p>Now that we\u2019ve defined all the variables, adding the <code>register_post_type<\/code> function is easy.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n* Register the characters custom post type\n*\n* @since    1.0.0\n*\/\npublic function register_characters_cpt() {\n\n    $labels = array(\n        'name'                  =&gt; _x( 'Characters', 'Post Type General Name', 'tavern' ),\n        'singular_name'         =&gt; _x( 'Character', 'Post Type Singular Name', 'tavern' ),\n        'menu_name'             =&gt; __( 'The Tavern', 'tavern' ),\n        'name_admin_bar'        =&gt; __( 'Character Sheets', 'tavern' ),\n        'archives'              =&gt; __( 'Our Characters', 'tavern' ),\n        'attributes'            =&gt; __( 'Character Attributes', 'tavern' ),\n        'parent_item_colon'     =&gt; __( 'Parent Character:', 'tavern' ),\n        'all_items'             =&gt; __( 'All Characters', 'tavern' ),\n        'add_new_item'          =&gt; __( 'Add New Character', 'tavern' ),\n        'add_new'               =&gt; __( 'Add New', 'tavern' ),\n        'new_item'              =&gt; __( 'New Character', 'tavern' ),\n        'edit_item'             =&gt; __( 'Edit Character', 'tavern' ),\n        'update_item'           =&gt; __( 'Update Character', 'tavern' ),\n        'view_item'             =&gt; __( 'View Character', 'tavern' ),\n        'view_items'            =&gt; __( 'View Characters', 'tavern' ),\n        'search_items'          =&gt; __( 'Search Characters', 'tavern' ),\n        'not_found'             =&gt; __( 'Not found', 'tavern' ),\n        'not_found_in_trash'    =&gt; __( 'Not found in Trash', 'tavern' ),\n        'featured_image'        =&gt; __( 'Character Sketch', 'tavern' ),\n        'set_featured_image'    =&gt; __( 'Set character sketch', 'tavern' ),\n        'remove_featured_image' =&gt; __( 'Remove character sketch', 'tavern' ),\n        'use_featured_image'    =&gt; __( 'Use as character sketch', 'tavern' ),\n        'insert_into_item'      =&gt; __( 'Insert into character sheet', 'tavern' ),\n        'uploaded_to_this_item' =&gt; __( 'Uploaded to this character sheet', 'tavern' ),\n        'items_list'            =&gt; __( 'Character list', 'tavern' ),\n        'items_list_navigation' =&gt; __( 'Character list navigation', 'tavern' ),\n        'filter_items_list'     =&gt; __( 'Filter character list', 'tavern' ),\n    );\n\n    $args = array(\n        'label'                 =&gt; __( 'Character', 'tavern' ),\n        'description'           =&gt; __( 'Stats and Lore about our Characters', 'tavern' ),\n        'labels'                =&gt; $labels,\n        'supports'              =&gt; array( 'title', 'author', 'editor', 'thumbnail', 'comments', 'trackbacks' ),\n        'hierarchical'          =&gt; false,\n        'public'                =&gt; true,\n        'show_ui'               =&gt; true,\n        'show_in_menu'          =&gt; true,\n        'menu_position'         =&gt; 5,\n        'menu_icon'             =&gt; 'dashicons-beer',\n        'show_in_admin_bar'     =&gt; true,\n        'show_in_nav_menus'     =&gt; true,\n        'can_export'            =&gt; true,\n        'has_archive'           =&gt; true,\n        'exclude_from_search'   =&gt; false,\n        'publicly_queryable'    =&gt; true,\n        'capability_type'       =&gt; 'post',\n        'show_in_rest'\t\t\t=&gt; true,\n        'rest_base'\t\t\t\t=&gt; 'tavern-api',\n        'rest_controller_class'\t=&gt; 'WP_REST_Posts_Controller',\n    );\n    register_post_type( 'characters', $args );\n\n}<\/code><\/pre>\n\n\n\n<p><strong>Calling the Action<\/strong><\/p>\n\n\n\n<p>Open <code>tavern\/includes\/class-tavern.php<\/code>. This is the file where all your actions, hooks, and filters are called. Instead of calling the <code>init<\/code> action directly under our function, we\u2019re keeping things tidy by calling all of our actions in the same place. At <code>line 153<\/code>, you\u2019ll see a <code>define_admin_hooks()<\/code> function, to which you will add the following code snippet.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$this-&gt;loader-&gt;add_action( 'init', $plugin_admin, 'register_characters_cpt' );<\/code><\/pre>\n\n\n\n<p><strong>Activate the Plugin<\/strong><\/p>\n\n\n\n<p>Navigate to the Plugins screen in your <a href=\"https:\/\/www.hostgator.com\/blog\/wordpress-login-dashboard-guide\/\">WordPress admin dashboard<\/a> and activate the plugin. Once activated, you\u2019ll see The Tavern pop up in your left hand menu.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/Hy5rxYJXgIlLlYc9FCnC40wvmYuxKP92lIQjj455SrH0n7wNRIugLdd7I5RXYZF-hr1a_ZRMvYiAoI_-K3RfMvN8EebzwTh5F9-mv0H_RXgcdpiBbK0auFMrYBveZSFJsye6rpdF\" alt=\"activate wordpress plugin\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-3-set-up-the-block-template\">Step 3: Set-up the Block Template<\/h3>\n\n\n\n<p>Remember how we set up those wireframes earlier? Well, it\u2019s time to get those out and start working on adding our first character into The Tavern. This section will have you switching between the dashboard and your plugin code pretty regularly. Just follow these steps.<\/p>\n\n\n\n<p><strong>1. Add a New Character<\/strong><\/p>\n\n\n\n<p>When you navigate to <em>The Tavern &gt; Add New<\/em>, a page will pop up that looks like your standard post editing experience.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/Xt-SZp5kETZDOEQPly0f-Dt1qPenkl1RrlQ0nM9clqh9TXoqEKmQrtTY0HoZafjUcnhzy8xAdlDeSeUcuCgKYfQLi4ewWHJILBJHW06uVow3O3K1cu1A0s-j7_0jCkEQeqCoWNaS\" alt=\"add new page in wordpress\"\/><\/figure>\n\n\n\n<p>Using the block system, frame out a default character sheet from the Edit screen. This should match your wireframes.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/7ZAVZMlIe18O9xsvtSQOrXe8ZAxUKZEKV8mTaUpObq-1S8UT1ZhwK3hs1APM0IXJA0IjtvmV3ys25ZfdLZCIysa7iW36tCrIL6AMgUByv-nsxI--6AIRfs9nSOBG-JaMO7TM8NN1\" alt=\"build custom post type in wordpress\"\/><\/figure>\n\n\n\n<p>Then click the three dots in the top right corner to switch to <em>Code Editor<\/em>. This will be a helpful reference when you\u2019re coding the template into your plugin.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/VtW2qm2LF8BApSDpmEDHv3wj9RHTW5ea1PpLyUptJ_6GnCI7TnJy6GED_6bUYjmXpK2eu_En5S_fKVLVGEhiTUaGv-R_iToKCJQ820kdy0SPax6EI9bFBluKQcqGr5D7ehBm_Te7\" alt=\"how to code wordpress custom post type\"\/><\/figure>\n\n\n\n<p><strong>2. Define the Function<\/strong><\/p>\n\n\n\n<p>Open <code>tavern\/admin\/class-tavern-admin.php<\/code>.<\/p>\n\n\n\n<p>You can add the <a rel=\"noopener noreferrer\" href=\"https:\/\/developer.wordpress.org\/block-editor\/developers\/block-api\/block-templates\/\" target=\"_blank\">block template<\/a> code in through your existing <code>register_post_type<\/code> function, but I\u2019d recommend putting this into its own function to keep it from turning into spaghetti.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n* Set up the character block template\n*\n* @since    1.0.0\n*\/\npublic function register_character_template() {\n    \/** start coding here **\/\n}<\/code><\/pre>\n\n\n\n<p><strong>3. Set up the Template<\/strong><\/p>\n\n\n\n<p>Nested <a href=\"https:\/\/developer.wordpress.org\/block-editor\/developers\/block-api\/block-templates\/\" target=\"_blank\" rel=\"noopener noreferrer\">block template<\/a> arrays can get a little hairy, so it\u2019s best to build it out in sections to avoid having to chase down errant closing tags.&nbsp;<\/p>\n\n\n\n<p>For starters, the breakdown of a block array is as follows:<\/p>\n\n\n\n<p><code>array( '\u02dcblock-library\/block-name\u2019, array( '\u02dccontent\u2019 =&gt; '\u02dcand other properties\u2019 ) )<\/code><\/p>\n\n\n\n<p>Nested blocks have an additional array to hold the blocks contained within and follow this format:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>array( 'core\/columns', array($props), array(\n  array( 'core\/column', array($props), array($contents) ),\n  array( 'core\/column', array($props), array($contents) ),\n) );<\/code><\/pre>\n\n\n\n<p>First, frame out your columns and full-width blocks.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$template = array(\n    array( 'core\/columns', array(), array(\n        array( 'core\/column', array(), array(\n            array( 'core\/columns', array(), array(\n                array( 'core\/column', array(), array() ),\n                array( 'core\/column', array(), array() ),\n                array( 'core\/column', array(), array() ),\n            ) ),\n        ) ),\n        array( 'core\/column', array(), array() ),\n    ) ),\n    array( 'core\/heading', array() ),\n    array( 'core\/columns', array(), array(\n        array( 'core\/column', array(), array() ),\n        array( 'core\/column', array(), array(\n            array( 'core\/columns', array(), array(\n                array( 'core\/column', array(), array() ),\n                array( 'core\/column', array(), array() ),\n            ) ),\n        ) ),\n    ) ),\n    array( 'core\/heading', array() ),\n    array( 'core\/paragraph', array() ),\n);<\/code><\/pre>\n\n\n\n<p>Next, add your nested blocks in.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$template = array(\n    array( 'core\/columns', array(), array(\n        array( 'core\/column', array(), array(\n            array( 'core\/columns', array(), array(\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array() ),\n                ) ),\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array() ),\n                ) ),\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array() ),\n                ) ),\n            ) ),\n        ) ),\n        array( 'core\/column', array(), array(\n            array( 'core\/paragraph', array() ),\n        ) ),\n    ) ),\n    array( 'core\/heading', array() ),\n    array( 'core\/columns', array(), array(\n        array( 'core\/column', array(), array(\n            array( 'core\/heading', array() ),\n            array( 'core\/image', array() ),\n        ) ),\n        array( 'core\/column', array(), array(\n            array( 'core\/heading', array() ),\n            array( 'core\/columns', array(), array(\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array() ),\n                    array( 'core\/paragraph', array() ),\n                    array( 'core\/paragraph', array() ),\n                    array( 'core\/paragraph', array() ),\n                ) ),\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array() ),\n                    array( 'core\/paragraph', array() ),\n                    array( 'core\/paragraph', array() ),\n                ) ),\n            ) ),\n        ) ),\n    ) ),\n    array( 'core\/heading', array() ),\n    array( 'core\/paragraph', array() ),\n);<\/code><\/pre>\n\n\n\n<p>Then, add additional properties. You can find the properties of the additional attributes by checking the Code Editor on the test build you did through the dashboard. Some additional properties you won\u2019t find there are <code>content<\/code> and <code>placeholder<\/code> for defining the text within the block on load.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$template = array(\n   array( 'core\/columns', array(), array(\n       array( 'core\/column', array(), array(\n           array( 'core\/columns', array(\n               'className' =&gt; 'base-stats',\n           ), array(\n               array( 'core\/column', array(), array(\n                   array( 'core\/paragraph', array(\n                       'content' =&gt; 'Lvl #',\n                   ) ),\n               ) ),\n               array( 'core\/column', array(), array(\n                   array( 'core\/paragraph', array(\n                       'placeholder' =&gt; 'race',\n                   ) ),\n               ) ),\n               array( 'core\/column', array(), array(\n                   array( 'core\/paragraph', array(\n                       'placeholder' =&gt; 'class',\n                   ) ),\n               ) ),\n           ) ),\n       ) ),\n       array( 'core\/column', array(), array(\n           array( 'core\/paragraph', array(\n               'backgroundColor' =&gt; 'purple',\n               'content' =&gt; '&lt;em&gt;Player:&lt;\/em&gt; Your Name',\n           ) ),\n       ) ),\n   ) ),\n   array( 'core\/heading', array(\n       'content' =&gt; 'Character Details',\n   ) ),\n   array( 'core\/columns', array(), array(\n       array( 'core\/column', array(\n           'width' =&gt; '33.33%'\n       ), array(\n           array( 'core\/heading', array(\n               'level' =&gt; 3,\n               'content' =&gt; 'Appearance',\n           ) ),\n           array( 'core\/image', array(\n               'className' =&gt; 'is-style-twentytwentyone-image-frame',\n           ) ),\n       ) ),\n       array( 'core\/column', array(\n           'width' =&gt; '66.66%',\n       ), array(\n           array( 'core\/heading', array(\n                'level' =&gt; 3,\n               'content' =&gt; 'Traits',\n           ) ),\n           array( 'core\/columns', array(), array(\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Alignment:&lt;\/strong&gt; true neutral',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Age:&lt;\/strong&gt; ##',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Height:&lt;\/strong&gt; #\\'#\"',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Weight:&lt;\/strong&gt; ###lbs',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                ) ),\n                array( 'core\/column', array(), array(\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Background:&lt;\/strong&gt; bg',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Eye Color:&lt;\/strong&gt; color',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                    array( 'core\/paragraph', array(\n                        'content' =&gt; '&lt;strong&gt;Hair Color:&lt;\/strong&gt; color',\n                        'fontSize' =&gt; 'extra-small',\n                    ) ),\n                ) ),\n            ) ),\n       ) ),\n   ) ),\n   array( 'core\/heading', array(\n       'content' =&gt; 'Character Backstory',\n    ) ),\n   array( 'core\/paragraph', array(\n       'placeholder' =&gt; 'Enter your character\\'s backstory...',\n   ) ),\n);<\/code><\/pre>\n\n\n\n<p><strong>4. Update the Characters Object and Lock the Template<\/strong><\/p>\n\n\n\n<p>With the template defined, we\u2019ll tell WordPress to update the template for the <code>characters<\/code> post type and add a property to lock the template. Locking the template keeps the block layout from being manipulated (and keep the design from getting f*cked up).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n* Set up the character block template\n*\n* @since    1.0.0\n*\/\npublic function register_character_template() {\n    $template = array(\n        array( 'core\/columns', array(\n            'verticalAlignment' =&gt; 'center',\n        ), array(\n            array( 'core\/column', array(), array(\n                array( 'core\/columns', array(\n                    'className' =&gt; 'base-stats',\n                ), array(\n                    array( 'core\/column', array(), array(\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; 'Lvl #',\n                        ) ),\n                    ) ),\n                    array( 'core\/column', array(), array(\n                        array( 'core\/paragraph', array(\n                            'placeholder' =&gt; 'race',\n                        ) ),\n                    ) ),\n                    array( 'core\/column', array(), array(\n                        array( 'core\/paragraph', array(\n                            'placeholder' =&gt; 'class',\n                        ) ),\n                    ) ),\n                ) ),\n            ) ),\n            array( 'core\/column', array(), array(\n                array( 'core\/paragraph', array(\n                    'backgroundColor' =&gt; 'purple',\n                    'content' =&gt; '&lt;em&gt;Player:&lt;\/em&gt; Your Name Here',\n                ) ),\n            ) ),\n        ) ),\n        array( 'core\/heading', array(\n            'content' =&gt; 'Character Details',\n        ) ),\n        array( 'core\/columns', array(), array(\n            array( 'core\/column', array(\n                'width' =&gt; '33.33%',\n            ), array(\n                array( 'core\/heading', array(\n                    'level' =&gt; 3,\n                    'content' =&gt; 'Appearance',\n                ) ),\n                array( 'core\/image', array(\n                    'className' =&gt; 'is-style-twentytwentyone-image-frame',\n                ) ),\n            ) ),\n            array( 'core\/column', array(\n                'width' =&gt; '66.66%',\n            ), array(\n                array( 'core\/heading', array(\n                    'level' =&gt; 3,\n                    'content' =&gt; 'Traits',\n                ) ),\n                array( 'core\/columns', array(\n                    'className' =&gt; ''\n                ), array(\n                    array( 'core\/column', array(), array(\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Alignment:&lt;\/strong&gt; true neutral',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Age:&lt;\/strong&gt; ##',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Height:&lt;\/strong&gt; #\\'#\"',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Weight:&lt;\/strong&gt; ###lbs',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                    ) ),\n                    array( 'core\/column', array(), array(\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Background:&lt;\/strong&gt; bg',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Eye Color:&lt;\/strong&gt; color',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                        array( 'core\/paragraph', array(\n                            'content' =&gt; '&lt;strong&gt;Hair Color:&lt;\/strong&gt; color',\n                            'fontSize' =&gt; 'extra-small',\n                        ) ),\n                    ) ),\n                ) ),\n            ) ),\n        ) ),\n        array( 'core\/heading', array(\n            'content' =&gt; 'Character Backstory',\n        ) ),\n        array( 'core\/paragraph', array(\n            'placeholder' =&gt; 'Enter your character\\'s backstory...',\n        ) ),\n    );\n    $post_type_object = get_post_type_object('characters');\n    $post_type_object-&gt;template = $template;\n    $post_type_object-&gt;template_lock = 'all';\n}<\/code><\/pre>\n\n\n\n<p><strong>5. Call the Action<\/strong><\/p>\n\n\n\n<p>Open <code>tavern\/includes\/class-tavern.php<\/code>. We\u2019ll add this new action right under our <code>register_characters_cpt<\/code> action.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$this-&gt;loader-&gt;add_action( 'init', $plugin_admin, 'register_character_template' );<\/code><\/pre>\n\n\n\n<p><strong>6. Test it Out<\/strong><\/p>\n\n\n\n<p>Go ahead and add a new character in from the admin dashboard. All of the blocks on the page should be laid out as you set them up in your block template array.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/A24UjdeAJHVC7BkdZrwk7M_X8Xp_UVen43IDMp_3PyOkzYJtBmPGFCtfSoXGAP7jY_y-eZUQDDHbeViCboxW3h8cnVuJ_KL2gr73oKZdJJHBtY6E9ddQRN0GHw-8nvgTgdlUtsgU\" alt=\"wordpress custom post type\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-wrapping-up\">Wrapping up<\/h2>\n\n\n\n<p>After testing, you should be able to install your CPT on your client\u2019s site and begin building out their starter library. It is usually helpful to have a walkthrough meeting with them to give them a short training session on adding and updating their library.<\/p>\n\n\n\n<p>This tutorial barely scratches the surface of what can be done. WordPress custom post types are capable of so much more, like creating custom library pages for enhanced browsing or setting up custom taxonomies allowing for even better organization. Perhaps we\u2019ll go into that at a later date, but this is a good start.<\/p>\n\n\n\n<p>Armed with this new CPT knowledge in your tool box, we\u2019re hoping you\u2019ll be confident to do some more exploring. Start building today with <a href=\"https:\/\/www.hostgator.com\/managed-wordpress-hosting\">WordPress hosting<\/a> from HostGator.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While WordPress\u2019s available posts and pages cover most needs for static websites and blogs, custom post types can transform your&#8230;<\/p>\n","protected":false},"author":190,"featured_media":27592,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[104,151,134,120,121],"class_list":["post-27585","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-and-hosting-tips","tag-featured","tag-freelance-business","tag-next-level-wordpress","tag-shared-hosting","tag-wordpress-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.2 (Yoast SEO v23.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to use WordPress custom post types to make editing a breeze for your clients - HostGator<\/title>\n<meta name=\"description\" content=\"WordPress custom post types make editing a breeze for your clients (without f**king up your design). Learn how to build your own!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use WordPress custom post types to make editing a breeze for your clients\" \/>\n<meta property=\"og:description\" content=\"WordPress custom post types make editing a breeze for your clients (without f**king up your design). Learn how to build your own!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\" \/>\n<meta property=\"og:site_name\" content=\"HostGator\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/HostGator\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/samjeansoper\/\u00c2\u00a0\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-02T17:21:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-20T17:43:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.hostgator.com\/blog\/wp-content\/\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1155\" \/>\n\t<meta property=\"og:image:height\" content=\"605\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Samantha Soper\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@samjeansoper\" \/>\n<meta name=\"twitter:site\" content=\"@HostGator\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Samantha Soper\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\"},\"author\":{\"name\":\"Samantha Soper\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/#\/schema\/person\/1518b3e081314da91f8fcd8861e56b7c\"},\"headline\":\"How to use WordPress custom post types to make editing a breeze for your clients\",\"datePublished\":\"2021-03-02T17:21:36+00:00\",\"dateModified\":\"2021-08-20T17:43:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\"},\"wordCount\":2067,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg\",\"keywords\":[\"featured\",\"Freelance Business\",\"Next Level WordPress\",\"Shared Hosting\",\"WordPress Hosting\"],\"articleSection\":[\"Web Hosting Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\",\"url\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\",\"name\":\"How to use WordPress custom post types to make editing a breeze for your clients - HostGator\",\"isPartOf\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg\",\"datePublished\":\"2021-03-02T17:21:36+00:00\",\"dateModified\":\"2021-08-20T17:43:11+00:00\",\"description\":\"WordPress custom post types make editing a breeze for your clients (without f**king up your design). Learn how to build your own!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage\",\"url\":\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg\",\"contentUrl\":\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg\",\"width\":1155,\"height\":605,\"caption\":\"How to use WordPress custom post types\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.hostgator.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use WordPress custom post types to make editing a breeze for your clients\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/#website\",\"url\":\"https:\/\/www.hostgator.com\/blog\/\",\"name\":\"HostGtaor\",\"description\":\"Web Hosting and Marketing Tips for Entrepreneurs\",\"publisher\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hostgator.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/#organization\",\"name\":\"HostGtaor\",\"url\":\"https:\/\/www.hostgator.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2019\/04\/cropped-HG-Logo_default-default.png\",\"contentUrl\":\"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2019\/04\/cropped-HG-Logo_default-default.png\",\"width\":1092,\"height\":215,\"caption\":\"HostGtaor\"},\"image\":{\"@id\":\"https:\/\/www.hostgator.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/HostGator\",\"https:\/\/x.com\/HostGator\",\"https:\/\/www.instagram.com\/hostgator\",\"https:\/\/www.linkedin.com\/company\/hostgator-com\",\"https:\/\/www.pinterest.com\/hostgator\/\",\"https:\/\/www.youtube.com\/user\/hostgator\"],\"email\":\"support@gator.com\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/#\/schema\/person\/1518b3e081314da91f8fcd8861e56b7c\",\"name\":\"Samantha Soper\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hostgator.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5f75036ce61011e6b2490bdc6c92fb9f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5f75036ce61011e6b2490bdc6c92fb9f?s=96&d=mm&r=g\",\"caption\":\"Samantha Soper\"},\"description\":\"Samantha Soper is a freelance UX strategist, front-end developer, and creative consultant, working with businesses and non-profits of all sizes to help manage their online presence and brand experience. She also runs a mural art and illustration\u00c2\u00a0business. Related links at: samsoper.art\/links\/\",\"sameAs\":[\"https:\/\/samanthasoper.com\/\",\"https:\/\/www.facebook.com\/samjeansoper\/\u00c2\u00a0\",\"https:\/\/www.instagram.com\/samsoper.art\/\",\"https:\/\/www.linkedin.com\/in\/samanthasoper\/\",\"https:\/\/x.com\/samjeansoper\",\"https:\/\/www.youtube.com\/channel\/UC9xt-5Jbq3aq24VGCtmYEfg\"],\"url\":\"https:\/\/www.hostgator.com\/blog\/author\/ssoper\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to use WordPress custom post types to make editing a breeze for your clients - HostGator","description":"WordPress custom post types make editing a breeze for your clients (without f**king up your design). Learn how to build your own!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/","og_locale":"en_US","og_type":"article","og_title":"How to use WordPress custom post types to make editing a breeze for your clients","og_description":"WordPress custom post types make editing a breeze for your clients (without f**king up your design). Learn how to build your own!","og_url":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/","og_site_name":"HostGator","article_publisher":"https:\/\/www.facebook.com\/HostGator","article_author":"https:\/\/www.facebook.com\/samjeansoper\/\u00c2\u00a0","article_published_time":"2021-03-02T17:21:36+00:00","article_modified_time":"2021-08-20T17:43:11+00:00","og_image":[{"width":1155,"height":605,"url":"https:\/\/www.hostgator.com\/blog\/wp-content\/\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg","type":"image\/jpeg"}],"author":"Samantha Soper","twitter_card":"summary_large_image","twitter_creator":"@samjeansoper","twitter_site":"@HostGator","twitter_misc":{"Written by":"Samantha Soper","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#article","isPartOf":{"@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/"},"author":{"name":"Samantha Soper","@id":"https:\/\/www.hostgator.com\/blog\/#\/schema\/person\/1518b3e081314da91f8fcd8861e56b7c"},"headline":"How to use WordPress custom post types to make editing a breeze for your clients","datePublished":"2021-03-02T17:21:36+00:00","dateModified":"2021-08-20T17:43:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/"},"wordCount":2067,"commentCount":0,"publisher":{"@id":"https:\/\/www.hostgator.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg","keywords":["featured","Freelance Business","Next Level WordPress","Shared Hosting","WordPress Hosting"],"articleSection":["Web Hosting Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/","url":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/","name":"How to use WordPress custom post types to make editing a breeze for your clients - HostGator","isPartOf":{"@id":"https:\/\/www.hostgator.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage"},"image":{"@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg","datePublished":"2021-03-02T17:21:36+00:00","dateModified":"2021-08-20T17:43:11+00:00","description":"WordPress custom post types make editing a breeze for your clients (without f**king up your design). Learn how to build your own!","breadcrumb":{"@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#primaryimage","url":"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg","contentUrl":"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2021\/02\/How-to-use-WordPress-custom-post-types.jpg","width":1155,"height":605,"caption":"How to use WordPress custom post types"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hostgator.com\/blog\/wordpress-custom-post-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hostgator.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to use WordPress custom post types to make editing a breeze for your clients"}]},{"@type":"WebSite","@id":"https:\/\/www.hostgator.com\/blog\/#website","url":"https:\/\/www.hostgator.com\/blog\/","name":"HostGtaor","description":"Web Hosting and Marketing Tips for Entrepreneurs","publisher":{"@id":"https:\/\/www.hostgator.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostgator.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hostgator.com\/blog\/#organization","name":"HostGtaor","url":"https:\/\/www.hostgator.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostgator.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2019\/04\/cropped-HG-Logo_default-default.png","contentUrl":"https:\/\/www.hostgator.com\/blog\/wp-content\/uploads\/2019\/04\/cropped-HG-Logo_default-default.png","width":1092,"height":215,"caption":"HostGtaor"},"image":{"@id":"https:\/\/www.hostgator.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/HostGator","https:\/\/x.com\/HostGator","https:\/\/www.instagram.com\/hostgator","https:\/\/www.linkedin.com\/company\/hostgator-com","https:\/\/www.pinterest.com\/hostgator\/","https:\/\/www.youtube.com\/user\/hostgator"],"email":"support@gator.com"},{"@type":"Person","@id":"https:\/\/www.hostgator.com\/blog\/#\/schema\/person\/1518b3e081314da91f8fcd8861e56b7c","name":"Samantha Soper","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostgator.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5f75036ce61011e6b2490bdc6c92fb9f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5f75036ce61011e6b2490bdc6c92fb9f?s=96&d=mm&r=g","caption":"Samantha Soper"},"description":"Samantha Soper is a freelance UX strategist, front-end developer, and creative consultant, working with businesses and non-profits of all sizes to help manage their online presence and brand experience. She also runs a mural art and illustration\u00c2\u00a0business. Related links at: samsoper.art\/links\/","sameAs":["https:\/\/samanthasoper.com\/","https:\/\/www.facebook.com\/samjeansoper\/\u00c2\u00a0","https:\/\/www.instagram.com\/samsoper.art\/","https:\/\/www.linkedin.com\/in\/samanthasoper\/","https:\/\/x.com\/samjeansoper","https:\/\/www.youtube.com\/channel\/UC9xt-5Jbq3aq24VGCtmYEfg"],"url":"https:\/\/www.hostgator.com\/blog\/author\/ssoper\/"}]}},"_links":{"self":[{"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/posts\/27585"}],"collection":[{"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/users\/190"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/comments?post=27585"}],"version-history":[{"count":9,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/posts\/27585\/revisions"}],"predecessor-version":[{"id":28373,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/posts\/27585\/revisions\/28373"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/media\/27592"}],"wp:attachment":[{"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/media?parent=27585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/categories?post=27585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostgator.com\/blog\/wp-json\/wp\/v2\/tags?post=27585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}