Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created February 8, 2017 13:28
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 tommcfarlin/17ab6e5d052da8d471b15cfd70ffa37c to your computer and use it in GitHub Desktop.
Save tommcfarlin/17ab6e5d052da8d471b15cfd70ffa37c to your computer and use it in GitHub Desktop.
[WordPress] WordPress Post Types: An Abstraction For Entities
<?php
add_action( 'init', 'acme_create_book_post_type' );
/**
* Creates a new custom post type called 'Book' using the smallest number of arguments
* to prepare the post type.
*/
function acme_create_book_post_type() {
$args = array(
'labels' => array(
'name' => 'Books',
'singular_name' => 'Book',
),
'public' => true,
);
register_post_type( 'acme_book', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment