Last active
August 29, 2015 14:17
-
-
Save joeyz/bb18723cfc2cd958c5da to your computer and use it in GitHub Desktop.
WP Testimonials CPT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// For use in functions.php | |
// Dont forget to re-save your permalinks so that it actually shows up. | |
if ( ! function_exists('custom_post_type_testimonials') ) { | |
// Register Custom Post Type | |
function custom_post_type_testimonials() { | |
$labels = array( | |
'name' => _x( 'Testimonial', 'Post Type General Name', 'twentyfifteen' ), | |
'singular_name' => _x( 'Testimonials', 'Post Type Singular Name', 'twentyfifteen' ), | |
'menu_name' => __( 'Testimonial', 'twentyfifteen' ), | |
'parent_item_colon' => __( 'Parent Testimonial:', 'twentyfifteen' ), | |
'all_items' => __( 'All Testimonials', 'twentyfifteen' ), | |
'view_item' => __( 'View Testimonial', 'twentyfifteen' ), | |
'add_new_item' => __( 'Add New Testimonial', 'twentyfifteen' ), | |
'add_new' => __( 'Add New', 'twentyfifteen' ), | |
'edit_item' => __( 'Edit Testimonial', 'twentyfifteen' ), | |
'update_item' => __( 'Update Testimonial', 'twentyfifteen' ), | |
'search_items' => __( 'Search Testimonial', 'twentyfifteen' ), | |
'not_found' => __( 'Not found', 'twentyfifteen' ), | |
'not_found_in_trash' => __( 'Not found in Trash', 'twentyfifteen' ), | |
); | |
$rewrite = array( | |
'slug' => 'testimonial', | |
'with_front' => true, | |
'pages' => true, | |
'feeds' => true, | |
); | |
$args = array( | |
'label' => __( 'eemjii_testimonials', 'twentyfifteen' ), | |
'description' => __( 'Post Type Description', 'twentyfifteen' ), | |
'labels' => $labels, | |
'supports' => array( 'title', 'excerpt', 'thumbnail', ), | |
'taxonomies' => array( 'category', 'post_tag' ), | |
'hierarchical' => false, | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'show_in_nav_menus' => true, | |
'show_in_admin_bar' => true, | |
'menu_position' => 5, | |
'can_export' => true, | |
'has_archive' => true, | |
'exclude_from_search' => true, | |
'publicly_queryable' => true, | |
'rewrite' => $rewrite, | |
'capability_type' => 'page', | |
); | |
register_post_type( 'eemjii_testimonials', $args ); | |
} | |
// Hook into the 'init' action | |
add_action( 'init', 'custom_post_type_testimonials', 0 ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment