Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Created February 17, 2015 01:20
Show Gist options
  • Save designbuildtest/bd680fa09ee64bb05c35 to your computer and use it in GitHub Desktop.
Save designbuildtest/bd680fa09ee64bb05c35 to your computer and use it in GitHub Desktop.
Testimonials CPT
// Register 'Testimonial' Custom Post Type
function myplugin_testimonial_post_type() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name' ),
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name' ),
'menu_name' => __( 'Testimonials' ),
'add_new_item' => __( 'Add New Testimonial' ),
'search_items' => __( 'Search Testimonials' ),
);
$args = array(
'label' => __( 'Testimonials' ),
'labels' => $labels,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => false,
'show_in_admin_bar' => false,
'menu_position' => 25,
'menu_icon' => 'dashicons-testimonial',
'can_export' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'has_archive' => true,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'page-attributes' ),
'hierarchical' => true,
'capability_type' => 'page',
);
$args = apply_filters( 'myplugin_testimonial_args', $args ); // allow filtering
register_post_type( 'testimonial', $args );
}
add_action( 'init', 'myplugin_testimonial_post_type', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment