Skip to content

Instantly share code, notes, and snippets.

@theukedge
Last active August 29, 2015 14:08
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 theukedge/0adf13a39858afb88215 to your computer and use it in GitHub Desktop.
Save theukedge/0adf13a39858afb88215 to your computer and use it in GitHub Desktop.
<?php // REGISTER TESTIMONIAL CPT
if ( ! function_exists('twpb_testimonial_cpt') ) {
function twpb_testimonial_cpt() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name', 'twpb' ),
'singular_name' => _x( 'Testimonial', 'Post Type Singular Name', 'twpb' ),
'menu_name' => __( 'Testimonial', 'twpb' ),
'parent_item_colon' => __( 'Parent Testimonial:', 'twpb' ),
'all_items' => __( 'All Testimonials', 'twpb' ),
'view_item' => __( 'View Testimonial', 'twpb' ),
'add_new_item' => __( 'Add New Testimonial', 'twpb' ),
'add_new' => __( 'New Testimonial', 'twpb' ),
'edit_item' => __( 'Edit Testimonial', 'twpb' ),
'update_item' => __( 'Update Testimonial', 'twpb' ),
'search_items' => __( 'Search testimonials', 'twpb' ),
'not_found' => __( 'No testimonials found', 'twpb' ),
'not_found_in_trash' => __( 'No testimonials found in trash', 'twpb' ),
);
$args = array(
'label' => __( 'testimonial', 'twpb' ),
'description' => __( 'Client testimonials', 'twpb' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', ),
'taxonomies' => array( '' ),
'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-megaphone',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'testimonial', $args );
}
add_action( 'init', 'twpb_testimonial_cpt', 0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment