Skip to content

Instantly share code, notes, and snippets.

@huwrowlands
Created August 24, 2014 21:49
Show Gist options
  • Select an option

  • Save huwrowlands/ea7a9d54d40c6859b2c6 to your computer and use it in GitHub Desktop.

Select an option

Save huwrowlands/ea7a9d54d40c6859b2c6 to your computer and use it in GitHub Desktop.
CPT - Case Studies
<?php
// Register Custom Post Type
function register_case_studies_post_type() {
$labels = array(
'name' => _x( 'Case Studies', 'Post Type General Name', 'weaver' ),
'singular_name' => _x( 'Case Study', 'Post Type Singular Name', 'weaver' ),
'menu_name' => __( 'Case Studies', 'weaver' ),
'parent_item_colon' => __( 'Parent Case Study:', 'weaver' ),
'all_items' => __( 'All Case Studies', 'weaver' ),
'view_item' => __( 'View Case Study', 'weaver' ),
'add_new_item' => __( 'Add New Case Study', 'weaver' ),
'add_new' => __( 'Add New Case Study', 'weaver' ),
'edit_item' => __( 'Edit Case Study', 'weaver' ),
'update_item' => __( 'Update Case Study', 'weaver' ),
'search_items' => __( 'Search Case Studies', 'weaver' ),
'not_found' => __( 'No Case Studies found', 'weaver' ),
'not_found_in_trash' => __( 'No Case Studies found in Trash', 'weaver' ),
);
$rewrite = array(
'slug' => 'case-studies',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'Case Studies', 'weaver' ),
'description' => __( 'Marketing Case Studies', 'weaver' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ),
//'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-exerpt-view',
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'case-studies', $args );
}
// Hook into the 'init' action
add_action( 'init', 'register_case_studies_post_type', 0 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment