Created
September 13, 2014 14:08
-
-
Save ahaywood/415f3155188c529cd0cd to your computer and use it in GitHub Desktop.
PHP - WP: Custom Post Type Plugin
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 | |
/* | |
Plugin Name: Custom Post Types | |
Plugin URI: http://www.amyhaywood.com/ | |
Description: Declares a plugin that will create custom post types | |
Version: 1.0 | |
Author: Amy Haywood Dutton | |
Author URI: http://www.ahhacreative.com/ | |
*/ | |
add_action( 'init', 'create_custom_post_types' ); | |
function create_custom_post_types() { | |
/** | |
* | |
* PORTFOLIO PIECES | |
* | |
*/ | |
// register custom post type | |
register_post_type( 'portfolio', | |
array( | |
'labels' => array( | |
'name' => 'Portfolio', | |
'singular_name' => 'Portfolio', | |
'add_new' => 'Add New', | |
'add_new_item' => 'Add New Portfolio', | |
'edit' => 'Edit', | |
'edit_item' => 'Edit Portfolio', | |
'new_item' => 'New Portfolio', | |
'view' => 'View', | |
'view_item' => 'View Portfolio', | |
'search_items' => 'Search Portfolio', | |
'not_found' => 'No Portfolios found', | |
'not_found_in_trash' => 'No Portfolios found in Trash', | |
'parent' => 'Parent Portfolio' | |
), | |
'public' => true, | |
'hierarchical' => true, | |
'menu_position' => 15, | |
'supports' => array( 'title', 'editor', 'thumbnail' ), | |
'menu_icon' => 'dashicons-format-image', | |
'has_archive' => true | |
) | |
); | |
// register categories for portfolio items | |
register_taxonomy("portfolio_categories", array("portfolio"), array("hierarchical" => true, "label" => "Categories", "singular_label" => "Category", "rewrite" => true)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment