Last active
November 29, 2016 00:50
-
-
Save igolden/7f6aaec14e04037092d1 to your computer and use it in GitHub Desktop.
An example plugin.php
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 | |
/* | |
Plugin Name: Example Plugin | |
Plugin URI: http://domain.com | |
Description: Describe plugin | |
Version: 1.0 | |
*/ | |
/* | |
* Find, search, and replace "artist" to rename the object. Double check that you didn't miss "artists" | |
*/ | |
function artist_post_type() { | |
// Set UI labels for Custom Post Type | |
$labels = array( | |
'name' => _x( 'Artists', 'Post Type General Name', 'twentythirteen' ), | |
'singular_name' => _x( 'Artist', 'Post Type Singular Name', 'twentythirteen' ), | |
'menu_name' => __( 'Artists', 'twentythirteen' ), | |
'parent_item_colon' => __( 'Parent Artist', 'twentythirteen' ), | |
'all_items' => __( 'All Artists', 'twentythirteen' ), | |
'view_item' => __( 'View Artist', 'twentythirteen' ), | |
'add_new_item' => __( 'Add New Artist', 'twentythirteen' ), | |
'add_new' => __( 'Add New', 'twentythirteen' ), | |
'edit_item' => __( 'Edit Artist', 'twentythirteen' ), | |
'update_item' => __( 'Update Artist', 'twentythirteen' ), | |
'search_items' => __( 'Search Artist', 'twentythirteen' ), | |
'not_found' => __( 'Not Found', 'twentythirteen' ), | |
'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ), | |
); | |
// Set other options for Custom Post Type | |
$args = array( | |
'label' => __( 'artists', 'twentythirteen' ), | |
'description' => __( 'Artist news and reviews', 'twentythirteen' ), | |
'labels' => $labels, | |
// Features this CPT supports in Post Editor | |
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ), | |
// You can associate this CPT with a taxonomy or custom taxonomy. | |
'taxonomies' => array( 'genres' ), | |
/* A hierarchical CPT is like Pages and can have | |
* Parent and child items. A non-hierarchical CPT | |
* is like Posts. | |
*/ | |
'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' => false, | |
'publicly_queryable' => true, | |
'capability_type' => 'page', | |
); | |
// Registering your Custom Post Type | |
register_post_type( 'artists', $args ); | |
} | |
add_action( 'init', 'artist_post_type', 0 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment