Created
April 16, 2017 03:01
-
-
Save tammalee/6d9eedebdc138aef8e8b0dda6a75e12e to your computer and use it in GitHub Desktop.
mu-plugin Testimonial Custom Post Type
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 | |
/** | |
* @wordpress-plugin | |
* Plugin Name: Testimonials custom post type | |
* Plugin URI: [URL HERE] | |
* Description: Testimonials custom post type | |
* Version: 1.0.0 | |
* Author: [AUTHOR HERE] | |
* Author URI: [AUTHOR URI HERE] | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
* Text Domain: [TEXT DOMAIN HERE] | |
* Domain Path: /languages | |
*/ | |
// If this file is called directly, die. | |
if (!defined('WPINC')) { | |
die; | |
} | |
add_action('init', function () { | |
// Register the Testimonials custom post type | |
$labels = [ | |
'name' => _x('Testimonials', 'Post Type General Name', '[TEXT DOMAIN HERE]'), | |
'singular_name' => _x('Testimonial', 'Post Type Singular Name', '[TEXT DOMAIN HERE]'), | |
'menu_name' => __('Testimonials', '[TEXT DOMAIN HERE]'), | |
'parent_item_colon' => __('Parent Testimonial:', '[TEXT DOMAIN HERE]'), | |
'all_items' => __('All Testimonials', '[TEXT DOMAIN HERE]'), | |
'view_item' => __('View Testimonial', '[TEXT DOMAIN HERE]'), | |
'add_new_item' => __('Add New Testimonial', '[TEXT DOMAIN HERE]'), | |
'add_new' => __('Add New', '[TEXT DOMAIN HERE]'), | |
'edit_item' => __('Edit Testimonial', '[TEXT DOMAIN HERE]'), | |
'update_item' => __('Update Testimonial', '[TEXT DOMAIN HERE]'), | |
'search_items' => __('Search Testimonials', '[TEXT DOMAIN HERE]'), | |
'not_found' => __('Not found', '[TEXT DOMAIN HERE]'), | |
'not_found_in_trash' => __('Not found in Trash', '[TEXT DOMAIN HERE]'), | |
]; | |
$args = [ | |
'label' => __('testimonial', '[TEXT DOMAIN HERE]'), | |
'description' => __('Testimonial', '[TEXT DOMAIN HERE]'), | |
'labels' => $labels, | |
'supports' => ['title', 'thumbnail', 'editor', 'excerpt'], | |
'hierarchical' => false, | |
'public' => true, | |
'show_in_rest' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'show_in_nav_menus' => false, | |
'show_in_admin_bar' => true, | |
'menu_position' => 4, | |
'menu_icon' => 'dashicons-thumbs-up', | |
'can_export' => true, | |
'has_archive' => true, | |
'exclude_from_search' => false, | |
'publicly_queryable' => true, | |
'capability_type' => 'page', | |
]; | |
register_post_type('testimonials', $args); | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment