<?php
function my_custom_posttypes() {
$labels = array(
'name' => 'Testimonials',
'singular_name' => 'Testimonial',
'menu_name' => 'Testimonials',
'name_admin_bar' => 'Testimonial',
'add_new' => 'Add New',
'add_new_item' => 'Add New Testimonial',
'new_item' => 'New Testimonial',
'edit_item' => 'Edit Testimonial',
'view_item' => 'View Testimonial',
'all_items' => 'All Testimonials',
'search_items' => 'Search Testimonials',
'parent_item_colon' => 'Parent Testimonials:',
'not_found' => 'No testimonials found.',
'not_found_in_trash' => 'No testimonials found in Trash.',
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_icon' => 'dashicons-id-alt',
'query_var' => true,
'rewrite' => array( 'slug' => 'testimonials' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail' )
);
register_post_type( 'testimonial', $args );
}
add_action( 'init', 'my_custom_posttypes' );
// Flush rewrite rules to add "review" as a permalink slug
function my_rewrite_flush() {
my_custom_posttypes();
flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'my_rewrite_flush' );
?>