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;
}

Remove Genesis Header Right Widget on Homepage

To remove the Header Right Widget area from the homepage, you can use this code: … Read More

Change the Genesis Author Box Title

To change the Genesis Framework author box title, you can use a filter: More on get_the_author_meta(). … Read More

Add a Print Style Sheet to your Genesis Child Theme

The way a website prints is not necessarily how you want it to look. The good news is you can control it easily by adding a print stylesheet to your Theme. Don't forget to create a file called print.css in your child theme folder. … Read More

Add Content to the top of the Genesis Blog Page Template

By default, the Genesis Framework Blog Page Template does not allow you to display content added using the WordPress editor. In some cases you may want to add an image or additional information at the top of the page.  To enable this functionality, simply create a file named page_blog.php in your child theme directory, with the following content. … Read More

Genesis Custom Widget Post Titles

First, let me say that the Genesis Featured Posts widget is a wonderfully easy way to easily add customized content to a widgeted area. And, Nick's Genesis Featured Widget Amplified extends functionality greatly, including the option to automatically shorten post titles to a specific number of characters. However, sometimes shortening post titles automatically can result in words less meaningful … Read More