Created
May 7, 2012 00:11
-
-
Save jeremyfelt/2625099 to your computer and use it in GitHub Desktop.
A very basic example of register_post_type() in WordPress
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 | |
/* | |
* Creates a custom post type with the key 'prefix_post_type', with a basic | |
* configuration that provides for public access on the front end and admin. | |
* | |
*/ | |
add_action( 'init', 'prefix_register_post_type' ); | |
function prefix_register_post_types() { | |
$public_pt_args = array( | |
'label' => 'My Post Type', | |
'public' => true, | |
'publicly_queryable' => true, | |
'exclude_from_search' => false, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'has_archive' => true, | |
'rewrite' => true, | |
'query_var' => true, | |
); | |
register_post_type( 'prefix_post_type', $public_pt_args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment