Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wpspeak
Created July 15, 2013 04:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpspeak/5997551 to your computer and use it in GitHub Desktop.
Save wpspeak/5997551 to your computer and use it in GitHub Desktop.
Create a Portfolio Post Type
<?php
// Create a Portfolio Post Type
add_action( 'init', 'register_cpt_portfolio' );
function register_cpt_portfolio() {
$labels = array(
'name' => _x( 'Portfolio', 'portfolio' ),
'singular_name' => _x( 'Portfolio', 'portfolio' ),
'add_new' => _x( 'Add New', 'portfolio' ),
'add_new_item' => _x( 'Add New Portfolio', 'portfolio' ),
'edit_item' => _x( 'Edit Portfolio', 'portfolio' ),
'new_item' => _x( 'New Portfolio', 'portfolio' ),
'view_item' => _x( 'View Portfolio', 'portfolio' ),
'search_items' => _x( 'Search Portfolio', 'portfolio' ),
'not_found' => _x( 'No portfolio found', 'portfolio' ),
'not_found_in_trash' => _x( 'No portfolio found in Trash', 'portfolio' ),
'parent_item_colon' => _x( 'Parent Portfolio:', 'portfolio' ),
'menu_name' => _x( 'Portfolio', 'portfolio' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'Some of our works.',
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail' ),
'taxonomies' => array( 'Service' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'portfolio', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment