follow mejoin mesubscribe

Add a Taxonomy to the Minimum Pro Theme Portfolio

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;
}
About Jennifer Baumann

I am an avid horseback rider, animal lover, and freelance designer. I love working with WordPress and Genesis and work for Copyblogger Media as a Technical Support Advocate.

Dream Whisper Designs is Powered by Genesis

StudioPress Premium WordPress Themes

Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!

Take advantage of the 6 default layout options, comprehensive SEO settings, rock-solid security, flexible theme options, cool custom widgets, custom design hooks, and a huge selection of child themes ("skins") that make your site look the way you want it to. With automatic theme updates and world-class support included, Genesis is the smart choice for your WordPress website or blog.