Created
September 17, 2014 20:24
-
-
Save keirwhitaker/ccf0758a7144b3f36507 to your computer and use it in GitHub Desktop.
A custom post type for photos
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 | |
add_action( 'init', 'register_cpt_photo' ); | |
function register_cpt_photo() { | |
$labels = array( | |
'name' => _x( 'Photos', 'photo' ), | |
'singular_name' => _x( 'Photo', 'photo' ), | |
'add_new' => _x( 'Add New', 'photo' ), | |
'add_new_item' => _x( 'Add New Photo', 'photo' ), | |
'edit_item' => _x( 'Edit Photo', 'photo' ), | |
'new_item' => _x( 'New Photo', 'photo' ), | |
'view_item' => _x( 'View Photo', 'photo' ), | |
'search_items' => _x( 'Search Photos', 'photo' ), | |
'not_found' => _x( 'No photos found', 'photo' ), | |
'not_found_in_trash' => _x( 'No photos found in Trash', 'photo' ), | |
'parent_item_colon' => _x( 'Parent Photo:', 'photo' ), | |
'menu_name' => _x( 'Photos', 'photo' ), | |
); | |
$args = array( | |
'labels' => $labels, | |
'hierarchical' => false, | |
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ), | |
'public' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'menu_position' => 5, | |
'menu_icon' => 'dashicons-camera', | |
'show_in_nav_menus' => true, | |
'publicly_queryable' => true, | |
'exclude_from_search' => false, | |
'has_archive' => true, | |
'query_var' => true, | |
'can_export' => true, | |
'rewrite' => array( | |
'slug' => 'photos', | |
'with_front' => false, | |
'feeds' => true, | |
'pages' => true | |
), | |
'capability_type' => 'post' | |
); | |
register_post_type( 'photo', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment