The Minimum Pro Theme for the Genesis Theme Framework includes a custom post type to create a portfolio. If you would like to create categories for the StudioPress Minimum Pro Theme Portfolio, you can create a custom taxonomy. Following this tutorial, will give you a method of categorizing your portfolio images.
Step 1: Find the following code in your functions.php file:
/** Create portfolio custom post type */ add_action( 'init', 'minimum_portfolio_post_type' ); function minimum_portfolio_post_type() { register_post_type( 'portfolio', array( 'labels' => array( 'name' => __( 'Portfolio', 'minimum' ), 'singular_name' => __( 'Portfolio', 'minimum' ), ), 'exclude_from_search' => true, 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/portfolio.png', 'public' => true, 'rewrite' => array( 'slug' => 'portfolio' ), 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'genesis-seo' ), ) ); }
Step 2: Replace that code with this:
/** Create portfolio custom post type */ add_action( 'init', 'minimum_portfolio_post_type' ); function minimum_portfolio_post_type() { register_post_type( 'portfolio', array( 'labels' => array( 'name' => __( 'Portfolio', 'minimum' ), 'singular_name' => __( 'Portfolio', 'minimum' ), ), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/portfolio.png', 'public' => true, 'rewrite' => array( 'slug' => 'portfolio' ), 'taxonomies' => array( 'portfolio-type' ), 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'genesis-seo' ), ) ); } /* Register Portfolio Taxonomy */ add_action( 'init', 'create_portfolio_tax' ); function create_portfolio_tax() { register_taxonomy( 'portfolio-type', 'portfolio', array( 'label' => __( 'Type' ), 'hierarchical' => true ) ); }
Step 3: Copy the archive-portfolio.php template from the child theme folder and save it as taxonomy-portfolio-type.php
Step4: Go to Settings > Permalinks and resave
Step 5: Go categorize some portfolio images! Then view your category at http://yoururl.com/portfolio-type/category-slug/
Step 6: Edit the existing styles in the Portfolio section of the theme to include CSS for .tax-portfolio-type .entry
as shown below (may vary depending on theme version). You’ll need to find the existing CSS in your style.css file and add the appropriate lines.
.tax-portfolio-type .entry, .post-type-archive-portfolio .entry { float: left; margin-bottom: 60px; margin-bottom: 6rem; width: 50%; } .tax-portfolio-type .entry:nth-of-type(2n), .post-type-archive-portfolio .entry:nth-of-type(2n) { float: right; padding-left: 30px; padding-left: 3rem; } .tax-portfolio-type .entry:nth-of-type(2n+1), .post-type-archive-portfolio .entry:nth-of-type(2n+1) { clear: left; padding-right: 30px; padding-right: 3rem; }
In the 1023px media query in the responsive section:
.tax-portfolio-type .entry, .post-type-archive-portfolio .entry, .site-header .title-area, .site-header .search-form, .site-header .widget-area, .site-tagline-left, .site-tagline-right { text-align: center; }
In the 768px media query in the responsive section:
.genesis-grid-even, .genesis-grid-odd, .tax-portfolio-type .entry, .post-type-archive-portfolio .entry { width: 100%; } .tax-portfolio-type .entry:nth-of-type(2n), .tax-portfolio-type .entry:nth-of-type(2n+1), .post-type-archive-portfolio .entry:nth-of-type(2n), .post-type-archive-portfolio .entry:nth-of-type(2n+1) { float: none; padding: 0; }
The post Add a Taxonomy to the Minimum Pro Theme Portfolio appeared first on Dream Whisper Designs.