Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save azizultex/11314165 to your computer and use it in GitHub Desktop.
Save azizultex/11314165 to your computer and use it in GitHub Desktop.
Custom Post type for Filterable Portfolio
/*
* Add a portfolio custom post type.
*/
add_action('init', 'create_redvine_portfolio');
function create_redvine_portfolio()
{
$labels = array(
'name' => _x('Portfolio', 'portfolio'),
'singular_name' => _x('Portfolio', 'portfolio'),
'add_new' => _x('Add New', 'portfolio'),
'add_new_item' => __('Add New Portfolio Item'),
'edit_item' => __('Edit Item'),
'new_item' => __('New Item'),
'view_item' => __('View Item'),
'search_items' => __('Search Items'),
'not_found' => __('No items found'),
'not_found_in_trash' => __('No items found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 20,
'supports' => array('title','editor','thumbnail')
);
register_post_type('portfolio',$args);
}
register_taxonomy( "portfolio-categories",
array( "portfolio" ),
array( "hierarchical" => true,
"labels" => array('name'=>"Creative Fields",'add_new_item'=>"Add New Field"),
"singular_label" => __( "Field" ),
"rewrite" => array( 'slug' => 'fields', // This controls the base slug that will display before each term
'with_front' => false)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment