Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Last active January 3, 2020 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanaf1979/d9430a03de0adbbb876e4de603e8d59a to your computer and use it in GitHub Desktop.
Save vanaf1979/d9430a03de0adbbb876e4de603e8d59a to your computer and use it in GitHub Desktop.
Create a custom post type gist for my WordPress: tutorial "Multiple Custom Templates for Posts and Custom Post Types" at https://since1979.dev/wordpress-multiple-custom-templates-for-posts-and-custom-post-types/
<?php
function create_product_post_type() {
register_post_type( 'product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true,
'show_in_rest' => true // To enable Gutenberg.
)
);
}
add_action( 'init', 'create_product_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment