Skip to content

Instantly share code, notes, and snippets.

@jankeesvw
Created August 14, 2010 08:31
Show Gist options
  • Save jankeesvw/524135 to your computer and use it in GitHub Desktop.
Save jankeesvw/524135 to your computer and use it in GitHub Desktop.
<?php
add_action('init', 'portfolio_init');
/**
* Initialize simple-portfolio plugin
*/
function portfolio_init() {
$custom_slug = get_option('slug') != '' ? get_option('slug') : 'portfolio';
$args = array(
'labels' => array(
'name' => __('Portfolio'),
'singular_name' => __('Portfolio Project'),
'add_new' => __('Add Project'),
'add_new_item' => __('Add Project'),
'new_item' => __('Add Project'),
'view_item' => __('View Project'),
'search_items' => __('Search Portfolio'),
'edit_item' => __('Edit Project'),
'all_items' => __('Complete Portfolio'),
'not_found' => __('No Projects found'),
'not_found_in_trash' => __('No Projects found in Trash')
),
'taxonomies' => array( 'portfolio-tags', 'portfolio-categories'),
'public' => true,
'show_ui' => true,
'_builtin' => false,
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'rewrite' => array('slug' => __($custom_slug)),
'hierarchical' => true,
'menu_position' => 20,
'menu_icon' => WP_PLUGIN_URL . '/simple-portfolio/images/icon.jpg',
'supports' => array('title', 'editor','comments')
);
register_taxonomy('portfolio-categories', 'portfolio-categories', array(
'hierarchical' => true,
'show_ui' => true,
'label' => __('Portfolio categories','portfolio-categories')
)
);
register_taxonomy('portfolio-tags', 'portfolio-tags', array(
'hierarchical' => false,
'show_ui' => true,
'label' => __('Portfolio tags','portfolio-tags')
)
);
/** create new custom post type */
register_post_type('portfolio', $args);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment