Created
December 27, 2013 15:09
-
-
Save pudgereyem/8148250 to your computer and use it in GitHub Desktop.
PHP, WORDPRESS: Register post type
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 | |
/* Init post types */ | |
add_action( 'init', 'wtf_post_resource_register' ); | |
/*-------------------------------------------------------------------------------------- | |
* | |
* wtf_post_resource_register | |
* | |
* @author Victor Meyer | |
* @since 0.1 | |
* | |
*-------------------------------------------------------------------------------------*/ | |
function wtf_post_resource_register() { | |
$labels = array( | |
'name' => __( 'Resources', 'wtf' ), | |
'singular_name' => __( 'Resource', 'wtf' ), | |
'add_new' => __( 'Add New', 'wtf' ), | |
'add_new_item' => __( 'Add New Resource', 'wtf' ), | |
'edit_item' => __( 'Edit Resource', 'wtf' ), | |
'new_item' => __( 'New Resource', 'wtf' ), | |
'view_item' => __( 'View Resource', 'wtf' ), | |
'search_items' => __( 'Search Resources', 'wtf' ), | |
'not_found' => __( 'No resources found', 'wtf' ), | |
'not_found_in_trash' => __( 'No resources found in Trash', 'wtf' ), | |
'parent_item_colon' => __( 'Parent Resource:', 'wtf' ), | |
'menu_name' => __( 'Resources', 'wtf' ) | |
); | |
$arguments = array( | |
'labels' => $labels, | |
'description' => __( 'Resource post type', 'wtf' ), | |
'public' => true, | |
'hierarchical' => true, // Enable custom menu order | |
'menu_position' => 5, | |
'supports' => array( 'title', 'editor', 'revisions' ), | |
'rewrite' => array( 'with_front' => false ) // Exclude front base | |
); | |
register_post_type( 'resource', $arguments ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment