Skip to content

Instantly share code, notes, and snippets.

@curtismchale
Last active June 20, 2016 22:17
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 curtismchale/7662101 to your computer and use it in GitHub Desktop.
Save curtismchale/7662101 to your computer and use it in GitHub Desktop.
/**
* Builds out the custom post types for the site
*
* @uses register_post_type
*
* @since 1.0
* @author SFNdesign, Curtis McHale
*/
function add_cpt(){
register_post_type( 'life_resource', // http://codex.wordpress.org/Function_Reference/register_post_type
array(
'labels' => array(
'name' => __('Resources'),
'singular_name' => __('Resource'),
'add_new' => __('Add New'),
'add_new_item' => __('Add New Resource'),
'edit' => __('Edit'),
'edit_item' => __('Edit Resource'),
'new_item' => __('New Resource'),
'view' => __('View Resource'),
'view_item' => __('View Resource'),
'search_items' => __('Search Resources'),
'not_found' => __('No Resources Found'),
'not_found_in_trash' => __('No Resources found in Trash')
), // end array for labels
'public' => true,
'menu_position' => 5, // sets admin menu position
//'menu_icon' => get_stylesheet_directory_uri().'/assets/images/show-post-icon.png',
'hierarchical' => false, // funcions like posts
'supports' => array('title', 'editor', 'revisions', 'excerpt', 'thumbnail'),
'rewrite' => array('slug' => 'resource-library', 'with_front' => true,), // permalinks format
'can_export' => true,
)
);
}
add_action( 'init', array( $this, 'add_cpt' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment