Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

sojoy testimonial cpt

testimonial cpt of sojoy theme

if ( ! function_exists('sojoy_testimonial_cpt') ) {

// Register Custom Post Type
function sojoy_testimonial_cpt() {

	$labels = array(
		'name'                => _x( 'Testimonials', 'Post Type General Name', 'sojoy-cpt' ),
		'singular_name'       => _x( 'Testimonial', 'Post Type Singular Name', 'sojoy-cpt' ),
		'menu_name'           => __( 'Testimonials', 'sojoy-cpt' ),
		'name_admin_bar'      => __( 'Testimonials', 'sojoy-cpt' ),
		'parent_item_colon'   => __( '', 'sojoy-cpt' ),
		'all_items'           => __( 'All Testimonials', 'sojoy-cpt' ),
		'add_new_item'        => __( 'Add New Testimonial', 'sojoy-cpt' ),
		'add_new'             => __( 'Add New', 'sojoy-cpt' ),
		'new_item'            => __( 'New Item', 'sojoy-cpt' ),
		'edit_item'           => __( 'Edit Testimonial', 'sojoy-cpt' ),
		'update_item'         => __( 'Update Testimonial', 'sojoy-cpt' ),
		'view_item'           => __( 'View Testimonial', 'sojoy-cpt' ),
		'search_items'        => __( 'Search Testimonial', 'sojoy-cpt' ),
		'not_found'           => __( 'Not found', 'sojoy-cpt' ),
		'not_found_in_trash'  => __( 'Not found in Trash', 'sojoy-cpt' ),
	);
	$args = array(
		'label'               => __( 'testimonial', 'sojoy-cpt' ),
		'description'         => __( 'Testimonial Post Type', 'sojoy-cpt' ),
		'labels'              => $labels,
		'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', ),
		'hierarchical'        => false,
		'public'              => true,
		'show_ui'             => true,
		'show_in_menu'        => true,
		'menu_position'       => 5,
		'menu_icon'           => 'dashicons-welcome-write-blog',
		'show_in_admin_bar'   => false,
		'show_in_nav_menus'   => false,
		'can_export'          => true,
		'has_archive'         => true,
		'exclude_from_search' => false,
		'publicly_queryable'  => true,
		'capability_type'     => 'post',
	);
	register_post_type( 'testimonial', $args );

}

// Hook into the 'init' action
add_action( 'init', 'sojoy_testimonial_cpt', 0 );

}