Skip to content

Instantly share code, notes, and snippets.

@guillermorangel
Created August 28, 2013 18:18
Show Gist options
  • Save guillermorangel/6369397 to your computer and use it in GitHub Desktop.
Save guillermorangel/6369397 to your computer and use it in GitHub Desktop.
<?php
add_action('init', 'woo_add_portfolio');
if ( !function_exists('woo_add_portfolio') ) {
function woo_add_portfolio()
{
$labels = array(
'name' => _x('Portfolio', 'post type general name', 'woothemes'),
'singular_name' => _x('Portfolio Item', 'post type singular name', 'woothemes'),
'add_new' => _x('Add New', 'slide', 'woothemes'),
'add_new_item' => __('Add New Portfolio Item', 'woothemes'),
'edit_item' => __('Edit Portfolio Item', 'woothemes'),
'new_item' => __('New Portfolio Item', 'woothemes'),
'view_item' => __('View Portfolio Item', 'woothemes'),
'search_items' => __('Search Portfolio Items', 'woothemes'),
'not_found' => __('No Portfolio Items found', 'woothemes'),
'not_found_in_trash' => __('No Portfolio Items found in Trash', 'woothemes'),
'parent_item_colon' => ''
);
$portfolioitems_rewrite = get_option('woo_portfolioitems_rewrite');
if(empty($portfolioitems_rewrite)) $portfolioitems_rewrite = 'portfolio-items';
$args = array(
'labels' => $labels,
'public' => false,
'publicly_queryable' => true,
'_builtin' => false,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug'=> $portfolioitems_rewrite),
'capability_type' => 'post',
'hierarchical' => false,
'menu_icon' => get_template_directory_uri() .'/includes/images/portfolio.png',
'menu_position' => null,
'supports' => array('title','editor','thumbnail', 'custom-fields'/*'author','excerpt','comments'*/),
'taxonomies' => array('post_tag') // add tags so portfolio can be filtered
);
register_post_type('portfolio',$args);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment