Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('init', 'create_portfolio');
- function create_portfolio() {
- $labels = array(
- 'name' => __('Portfolio', 'post type general name'),
- 'singular_name' => __('Project', 'post type singular name'),
- 'add_new' => __('Add New', 'portfolio item'),
- 'add_new_item' => __('Add New Project'),
- 'edit_item' => __('Edit Project'),
- 'new_item' => __('New Project'),
- 'view_item' => __('View Project'),
- 'search_items' => __('Search Projects'),
- 'not_found' => __('Nothing found'),
- 'not_found_in_trash' => __('Nothing found in Trash'),
- 'parent_item_colon' => ''
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'query_var' => true,
- 'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
- 'rewrite' => true,
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'menu_position' => null,
- 'supports' => array('title','editor','thumbnail')
- );
- register_post_type( 'portfolio' , $args );
- }
- register_taxonomy("Skills", array("portfolio"), array("hierarchical" => true, "label" => "Skills", "singular_label" => "Skill", "rewrite" => true));
- add_action("admin_init", "admin_init");
- function admin_init(){
- add_meta_box("website_url", "Website URL", "website_url", "portfolio", "side", "low");
- add_meta_box("special_notes", "Special Notes", "special_notes", "portfolio", "side", "low");
- }
- function website_url(){
- global $post;
- $custom = get_post_custom($post->ID);
- $website_url = $custom["website_url"][0];
- ?>
- <label>Website URL:</label>
- <input name="website_url" value="<?php echo $website_url; ?>" />
- <?php
- }
- function special_notes() {
- global $post;
- $custom = get_post_custom($post->ID);
- $special_notes = $custom["special_notes"][0];
- ?>
- <label>Special Notes:</label>
- <input name="special_notes" value="<?php echo $special_notes; ?>" />
- <?php
- }
- add_action('save_post', 'save_details');
- function save_details(){
- global $post;
- update_post_meta($post->ID, "website_url", $_POST["website_url"]);
- update_post_meta($post->ID, "special_notes", $_POST["special_notes"]);
- }
- add_action("manage_posts_custom_column", "portfolio_custom_columns");
- add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");
- function portfolio_edit_columns($columns){
- $columns = array(
- "cb" => "<input type=\"checkbox\" />",
- "title" => "Project Title",
- "description" => "Description",
- );
- return $columns;
- }
- function portfolio_custom_columns($column){
- global $post;
- switch ($column) {
- case "description":
- the_excerpt();
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement