Some StudioPress themes already include a portfolio page built into the child theme. Most use a custom post type however it can only be used to create one portfolio.
If you want more than one portfolio, then this tutorial is for you.
In this exercise, we’ll be duplicating the existing portfolio page used in the Minimum child theme.
Duplicating Existing Portfolio Page
Here’s a summary of the steps you’ll need to take:
- Copy & rename both archive-portfolio.php and single-portfolio.php files
- Copy & rename portfolio custom post type in functions.php file
- Copy & rename add new image size in functions.php file
- Copy & rename CSS code for portfolio classes in style.css file
You can either manually rename the code or use a text editor like Notepad++.
I used Notepad++ to search and find all code with the name ‘portfolio’ and replaced it using the name ‘second’.
Update: Here’s an easier way to convert category archive pages into portfolio style archive pages using the Balance child theme
Second Portfolio Archive Template
Here’s the code which needs to be pasted in a new PHP file named archive-second.php
Second Portfolio Single Template
Here’s the code which needs to be pasted in a new PHP file named single-second.php
Rename Portfolio Custom Post Type
This code also includes the new support for CPT archive pages included in Genesis 2.0
Second Portfolio Image Size
This code needs to be pasted in your child themes functions.php file.
Display Number Of Portfolio Items
Add this code in your child themes functions.php file to determine exactly how many items to display on your portfolio archives page.
Duplicate Second Portfolio CSS Code
Paste this code at the end of your child themes style.css file.
You could simply duplicate each CSS rule underneath the original rule and rename it using the second selector rather than paste all the code at the end of the file. This is the method i used to test it worked properly.
Themes Which Are 960px Wide
You will need to make changes to the CSS code if you want to use the code in this tutorial on a theme which is 960px wide.
Here’s the code you need to add to replace in your child themes style.css file.
Conclusion
I successfully completed the duplication of existing Portfolio custom post type without any problems however you may have to spend some time adjusting the CSS code for themes other than the Minimum theme.
Leave a Reply
You must be logged in to post a comment.