After years of wrestling around with a cumbersome portfolio page, I decided to create a custom post type for my website portfolio with a featured image and title for the archive page, and custom fields for the site url, and “Built with” icons for the framework and cms the site is built with. Now that all the coding is done, it’s a real time saver.
Update: 08-27-2013 – Thanks to a comment by Nathan, I updated the Portfolio tutorial to use the new Genesis 2.0 Custom Post Type Archive settings.
The following steps provide an overview of how to build a portfolio for a Genesis 2.0 template.
I will explain each of the following steps in detail:
- In your Genesis child theme folder, create a file called archive-portfolio.php
- In your Genesis child theme folder, create a file called single-portfolio.php
- Add the portfolio code to your Genesis child theme functions.php
- Optional – Add Custom Fieldscode to functions.php
- Add Custom-Metaboxes-and-Fields-for-WordPress code to functions.php
- Add Nick the Greek Genesis Custom Field Code to functions.php
- Add Custom-Metaboxes-and-Fields-for-WordPress code to functions.php
- Add Brad Dalton code for Previous / Next links on single portfolio pages to functions.php
- Add portfolio css rules to your theme’s styles.css
- Configure the Genesis Portfolio Archive
- Update your permalinks.
Renee says
I very much appreciate you posting this code. I recently upgraded to WordPress 3.6 with Genesis 2.0.
Nathan Schmidt says
Thank you for this tutorial. I had been trying to do this using a portfolio custom post type from another Studiopress theme I have and it wouldn’t work. Looks like some of the hooks have changed in the new Genesis 2.0 framework, which seemed to be the issue. My portfolio is working well, now.
Would you have a recommendation on what to use to get the archive page to display the posts in a particular order based on the ‘order’ field in the custom post type? I originally used a custom field for ‘order’, but then I noticed that in WP, the ‘order’ field is already built in to the ‘attributes’ panel on the new post admin page. I used WP_query w/ an array in my archive-portfolio.php page to try to populate the posts by the ‘order’ I had designated, but I’m not having any luck.
Any help would be appreciated… even a link to some documentation. I find a lot of posts on utilizing WP_Query, but nothing recent enough or along the lines of incorporating into a Genesis (2.0) theme.
Pat Fortino says
Not sure how to sort by order field. There are plenty of plugins that do that; seems like that would be easiest.
Nathan Schmidt says
I found a way to do it after breaking it a lot. I tried w/ WP_Query kind of unsuccessfully, but eventually, adding this in after the function that outputs the page header and before the function that plots out the posts got it to do what I wanted:
query_posts( array( 'post_type'=>'product-categories' , 'orderby' => 'menu_order' , 'order' => 'ASC' ));
Also, I saw on another post from Carrie Dils that activated the archive-page settings if you wish to add in content prior to the post output on the archive post page.
I found this useful, as well. Basically, in the function registering the custom-post-type, you add in:
‘genesis-cpt-archives-settings’ into the register_post_type function’s array where ‘supports’ are listed.
I found this to be a pretty cool baked in feature for Genesis 2.0
Pat Fortino says
Hi Nathan. Thanks for the update. I forgot about the genesis-cpt-archives-settings. I’m going to update my portfolio tutorial to include it since it makes adding a title or description to the ctp archive much easier.
Regarding your comment:
Not sure I understand what you mean. I don’t see any order field or option for it in the posts screen? Is this something you added using a plugin?
Nathan Schmidt says
I have to correct that earlier statement. The page attributes panel is only located in the ‘page’ screen when making or editing a page, not post (located in panel to the right of the description field). I hadn’t realized that the tutorial made the custom post type more of a page layout rather than post, but it looks like by adding the ‘page_attributes’ in the ‘supports’ array in the registering function (in function.php), it adds this behavior.
I suppose if you wanted to order posts in this manner, you could use a custom field and then integrate that into the query. This is likely why it wasn’t working before—I was trying to query posts rather than perhaps using something w/ page attributes. I hadn’t noticed this behavior until you brought this up. Now, I realize why it takes on the page attributes.
Pat Fortino says
Nathan. Thanks for that clarification.
WriteNoWrong says
Awesome tutorial! I know this wasn’t really covered, but how would you suggest going about adding custom taxonomies to said Custom Post Types and then presenting them?
Pat Fortino says
The current code has taxonomies for tags. If you want categories, add category to taxonimies. See below.
‘taxonomies’ => array( ‘category’, ‘post_tag’ ),
WriteNoWrong says
So say if I registered a custom taxonomy called “location.” I could theoretically just add that into the taxonomies line and it would present that data on the custom post type posting?
‘taxonomies’ => array( ‘location’, ‘category’, ‘post_tag’ ),
Pat Fortino says
In order to create a custom taxonomy, you need to register it. See this url for explanation: http://codex.wordpress.org/Taxonomies