__('Add New Portfolio Item', 'rustic'), 'edit_item' => __('Edit Portfolio Item', 'rustic'), 'new_item' => __('New Portfolio Item', 'rustic'), 'view_item' => __('View Portfolio Item', 'rustic'), 'search_items' => __('Search Portfolio Items', 'rustic'), 'not_found' => __('No portfolio items found', 'rustic'), 'not_found_in_trash' => __('No portfolio items found in Trash', 'rustic') ); $portfolio_item_args = array( 'label' => __('Portfolio Items', 'rustic'), 'labels' => $portfolio_item_labels, 'singular_label' => __('Porfolio Item', 'rustic'), 'public' => true, 'capability_type' => 'page', 'supports' => array('title', 'thumbnail', 'excerpt', 'editor', 'comments') ); register_post_type('portfolio-item', $portfolio_item_args); /** * Register taxonomies "portfolio" and "portfolio-tag". **/ $portfolio_labels = array( 'name' => _x('Portfolios', 'taxonomy general name', 'rustic'), 'all_items' => __('All Portfolios', 'rustic'), 'add_new_item' => __('Add New Portfolio', 'rustic'), 'new_item_name' => __('New Portfolio Name', 'rustic') ); $portfolio_args = array( 'labels' => $portfolio_labels, 'hierarchical' => true ); register_taxonomy( 'portfolio', 'portfolio-item', $portfolio_args ); $portfolio_tag_labels = array( 'name' => _x('Portfolio Tags', 'taxonomy general name', 'rustic'), 'all_items' => __('All Portfolio Tags', 'rustic'), 'add_new_item' => __('Add New Portfolio Tag', 'rustic'), 'new_item_name' => __('New Portfolio Tag Name', 'rustic') ); $portfolio_tag_args = array( 'labels' => $portfolio_tag_labels, 'hierarchical' => true ); register_taxonomy( 'portfolio-tag', 'portfolio-item', $portfolio_tag_args ); flush_rewrite_rules();//Fix 404 issue when viewing taxonomy archive pages (i.e. portfolios). } // end rustic_portfolio_init... /** * Customize admin pages. **/ function rustic_portfolio_item_column_names($columns){ $columns = array( "cb" => "", "title" => "Portfolio Item", "rustic_portfolio" => "Portfolio", "rustic_portfolio_tags" => "Portfolio Tags", "rustic_portfolio_item_thumbnail" => "Portfolio Item Thumbnail" ); return $columns; } function rustic_portfolio_item_column_contents($column){ global $post; switch ($column){ case "rustic_portfolio" : $portfolios = get_the_terms($post->ID, "portfolio"); $portfolio_names = array(); if($portfolios) { foreach ($portfolios as $portfolio) array_push($portfolio_names, $portfolio->name); echo implode($portfolio_names, ", "); } else { _e("Not in Portfolio", "rustic"); } break; case "rustic_portfolio_tags" : $portfolios = get_the_terms($post->ID, "portfolio-tag"); $portfolio_names = array(); if($portfolios) { foreach ($portfolios as $portfolio) array_push($portfolio_names, $portfolio->name); echo implode($portfolio_names, ", "); } else { _e("No Portfolio Tags", "rustic"); } break; case "rustic_portfolio_item_thumbnail" : if ( has_post_thumbnail() ) { the_post_thumbnail('portfolio-admin'); } else { print __('Please select a featured image.', 'rustic'); } break; } } add_filter("manage_edit-portfolio-item_columns", "rustic_portfolio_item_column_names"); add_action("manage_posts_custom_column", "rustic_portfolio_item_column_contents"); /** * Meta boxes. **/ add_action("admin_init", "rustic_portfolio_meta_box_init"); add_action('save_post', 'rustic_update_portfolio'); function rustic_update_portfolio(){ global $post; // to prevent metadata or custom fields from disappearing... if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return; update_post_meta($post->ID, "_rustic_portfolio_media_link", $_POST["_rustic_portfolio_media_link"]); } //Run on the admin_init hook... function rustic_portfolio_meta_box_init(){ add_meta_box( 'portfolio1', __('Enter a Portfolio Media Link', 'rustic'), 'rustic_portfolio_meta_box1', 'portfolio-item', 'normal', 'high'); } /*META BOX 1*/ function rustic_portfolio_meta_box1(){ $custom_fields = get_post_custom(); $portfolio_media_link = $custom_fields["_rustic_portfolio_media_link"][0]; ?> Here are the steps to make a portfolio item for your portfolio!

1. The first step is to choose the image that will appear in your portfolio as a thumbnail image. Click "Set featured image" (see box in right column). Click the "From Computer" tab, then press "Select Files" button. After you choose the image, be sure to click "Use as featured image" instead of "Insert into Post". Click the "File URL" button and copy the Link URL. Close by pressing the "x" in the upper right corner.

2. Put the full link to your media item into the box below. This will open in a light-box when you click the thumbnail image on your portfolio page. Either use the Link URL from the last step, or choose another link from the "Media" section of the WordPress admin. There you can click "edit" for the media item and you will see the link labled as "File URL". Most types of media will play in the light-box, including images, music mp3\'s, video mp4\'s and Flash flv files. Links to YouTube videos work too!

3. Choose a "Portfolio" or make a new one (see box in right column). Portfolios are similar to a Categories used to hold portfolio items.

4. Write something about your portfolio item in the box above, give the post a title and press Publish.

5. Continue to make some more portfolio items to fill your portfolio. Make sure the portfolio check-box is checked before publishing.

5. Go to Appearance->Menus in the WordPress admin and put your portfolio in the menu. Save the menu and make sure the correct menu is selected in "Theme Locations" box.

6. Look for your portfolio in the main menu. Click the link and admire you\'re beautiful new portfolio!

Here are some examples of valid media links:

Images

http://www.mysite.com/wp-content/uploads/2011/11/my_image.jpg

YouTube Video

http://www.youtube.com/watch?v=YCdFFFAxLz0

Vimeo Video

http://vimeo.com/32619535

MP3 Files

http://www.mysite.com/wp-content/uploads/2011/11/my_song.mp3

Flash SWF Files (note: width and height must be attached)

http://www.mysite.com/wp-content/uploads/2011/11/my_flashfile.swf?width=600&height=300

FLV FlashVideo Files (note: width and height must be attached)

http://www.mysite.com/wp-content/uploads/2011/11/my_flashvideo.flv?width=480&height=270

MP4 Video Files (note: width and height must be attached)

http://www.mysite.com/wp-content/uploads/2011/11/my_video.mp4?width=1280&height=720

Leave blank for no link.', "rustic"); ?>