-
-
Save tommcfarlin/17ab6e5d052da8d471b15cfd70ffa37c to your computer and use it in GitHub Desktop.
[WordPress] WordPress Post Types: An Abstraction For Entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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