Skip to content

Instantly share code, notes, and snippets.

@JeffAspen
Created October 27, 2016 14:15
Show Gist options
  • Save JeffAspen/640f24c212388f0d4db707af1377cd20 to your computer and use it in GitHub Desktop.
Save JeffAspen/640f24c212388f0d4db707af1377cd20 to your computer and use it in GitHub Desktop.
WP Testimonial CPT
// Register Custom Post Type
function cmms_testimonial_post_type() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name', 'cmms' ),
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'cmms' ),
'menu_name' => __( 'Testimonials', 'cmms' ),
'name_admin_bar' => __( 'Testimonial', 'cmms' ),
'archives' => __( 'Item Archives', 'cmms' ),
'parent_item_colon' => __( 'Parent Item:', 'cmms' ),
'all_items' => __( 'All Items', 'cmms' ),
'add_new_item' => __( 'Add New Item', 'cmms' ),
'add_new' => __( 'Add New', 'cmms' ),
'new_item' => __( 'New Item', 'cmms' ),
'edit_item' => __( 'Edit Item', 'cmms' ),
'update_item' => __( 'Update Item', 'cmms' ),
'view_item' => __( 'View Item', 'cmms' ),
'search_items' => __( 'Search Item', 'cmms' ),
'not_found' => __( 'Not found', 'cmms' ),
'not_found_in_trash' => __( 'Not found in Trash', 'cmms' ),
'featured_image' => __( 'Featured Image', 'cmms' ),
'set_featured_image' => __( 'Set featured image', 'cmms' ),
'remove_featured_image' => __( 'Remove featured image', 'cmms' ),
'use_featured_image' => __( 'Use as featured image', 'cmms' ),
'insert_into_item' => __( 'Insert into item', 'cmms' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'cmms' ),
'items_list' => __( 'Items list', 'cmms' ),
'items_list_navigation' => __( 'Items list navigation', 'cmms' ),
'filter_items_list' => __( 'Filter items list', 'cmms' ),
);
$args = array(
'label' => __( 'Testimonial', 'cmms' ),
'description' => __( 'Testimonial information page.', 'cmms' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'revisions', 'custom-fields', ),
'taxonomies' => array( 'category' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-format-quote',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'testimonials', $args );
}
add_action( 'init', 'cmms_testimonial_post_type', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment