Last active
September 30, 2016 07:44
-
-
Save phpbits/ccaf7d681c6e274b2a2ed607b231e54c to your computer and use it in GitHub Desktop.
Create Custom Post Type for Testimonials
This file contains hidden or 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 | |
| //Create CPT for testimonials | |
| add_action( 'init', 'testimonials_CPT', 0 ); | |
| function testimonials_CPT() { | |
| $labels = array( | |
| 'name' => __( 'Testimonials', 'focuswp' ), | |
| 'singular_name' => __( 'Testimonials', 'focuswp' ), | |
| 'menu_name' => __( 'Testimonials', 'focuswp' ), | |
| 'name_admin_bar' => __( 'Testimonials', 'focuswp' ), | |
| 'parent_item_colon' => __( 'Parent Item:', 'focuswp' ), | |
| 'all_items' => __( 'Testimonials', 'focuswp' ), | |
| 'add_new_item' => __( 'Add New Testimonial', 'focuswp' ), | |
| 'add_new' => __( 'Create Testimonial', 'focuswp' ), | |
| 'new_item' => __( 'New Testimonial', 'focuswp' ), | |
| 'edit_item' => __( 'Edit Testimonial Details', 'focuswp' ), | |
| 'update_item' => __( 'Update Testimonial Details', 'focuswp' ), | |
| 'view_item' => __( 'View Testimonials', 'focuswp' ), | |
| 'search_items' => __( 'Search Testimonials', 'focuswp' ), | |
| 'not_found' => sprintf( __( 'Whoops, looks like you haven\'t created any testimonials yet. <a href="%s">Create one now</a>!', 'focuswp' ), admin_url( 'post-new.php?post_type=testimonials' ) ), | |
| 'not_found_in_trash' => __( 'No items found in Trash.', 'focuswp' ), | |
| ); | |
| $args = array( | |
| 'label' => __( 'Testimonials', 'focuswp' ), | |
| 'description' => __( 'Testimonials', 'focuswp' ), | |
| 'labels' => $labels, | |
| 'supports' => array( 'title', 'editor' ), | |
| 'hierarchical' => false, | |
| 'public' => false, | |
| 'show_ui' => true, | |
| 'show_in_menu' => true, | |
| 'menu_position' => 54, | |
| 'show_in_admin_bar' => false, | |
| 'show_in_nav_menus' => false, | |
| 'can_export' => true, | |
| 'has_archive' => false, | |
| 'exclude_from_search' => true, | |
| 'publicly_queryable' => false, | |
| 'capability_type' => 'page', | |
| 'menu_icon' => 'dashicons-format-chat', | |
| ); | |
| register_post_type( 'testimonials', $args ); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment