Community Forums › Forums › Archived Forums › Design Tips and Tricks › Genesis Portfolio Pro plugin – custom templates
Tagged: Custom Post Type, Genesis Portfolio Pro
- This topic has 10 replies, 2 voices, and was last updated 6 years, 3 months ago by canpress5.
-
AuthorPosts
-
June 28, 2018 at 8:53 pm #221206canpress5Member
With the Genesis Portfolio Pro plugin I can customize the single-portfolio.php template which will allow me to use the same custom layout for all portfolio items.
What if I want to use several different custom templates for my portfolio items, is there a way to select from a list of templates when you add a new portfolio item, in the same way that you can select from a list of templates for a regular page?
Or is there another way to achieve the same thing, ie choose from multiple templates rather than have every portfolio item use the same template (single-portfolio.php)?Any ideas or relevant links would be much appreciated!
June 28, 2018 at 9:49 pm #221211canpress5MemberI managed to find the answer to this here.
To have different templates appear in the 'Page Attributes' section of the 'Edit Portfolio Item' screen you need to add 'portfolio' (or other custom post type) to the list of post types at the top of the template file, eg:
` <?php
/*
Template Name: Your Template
Template Post Type: post, page, portfolio
*/
// … your code here `
Then add the template to your child theme's root.June 29, 2018 at 3:04 pm #221221canpress5MemberI was a bit premature in marking this thread as resolved.
Further to the above post, although you can select a custom template for your portfolio item (as described above), that custom template is not actually used and Genesis Portfolio Pro defaults back to single-portfolio.php.
So, as far as I can tell you can only use one customized template within Genesis Portfolio Pro, namely a customized version of single-portfolio.php. Is this correct?June 30, 2018 at 12:03 am #221228Brad DaltonParticipantUse code to create a CPT and add your own templates in your child theme.
June 30, 2018 at 10:44 am #221248canpress5MemberThank you Brad, will give that a try.
June 30, 2018 at 10:47 am #221249Brad DaltonParticipantIf you didn't already know, you can copy and name the templates using the WordPress Template Hierarchy so they load on specific custom taxonomy archives. https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-taxonomies
June 30, 2018 at 11:23 am #221252canpress5MemberIn another thread I asked whether it was possible to choose from multiple archive templates for one CPT.
Is this how you would achieve that? (ie using different taxonomy-{taxonomy}.php templates rather than different archive-{post_type}.php templates?)June 30, 2018 at 8:23 pm #221261Brad DaltonParticipantFor the CPT archive, you would only use 1 template but if you wanted to create multiple archives for 1 CPT, you could add a template header
if your question relates to using different templates for each custom taxonomy, then yes, you would name the templates according to the WordPress Template Hierarchy so they load on archives for different taxonomy types.
As far as using the page_team.php file, you would need to modify the code in †he template to do this as it uses WP_Query.
June 30, 2018 at 10:34 pm #221266canpress5MemberBrad,
Can I ask your advice to make sure I'm heading in the right direction?My site features several Case Studies each of which is a substantial page in its own right and is not time sensitive (unlike a news item or blog post). New Case Studies will be added to the site on an ongoing basis. Because the content is 'timeless', in my mind each Case Study page should be a Page and not a Post.
Using different versions of the page_team.php template I can create several parent pages for these case studies to group them into different categories.
My only problem is that some of the case studies belong to more than one category and they can only have one Parent page each, so having the case studies as Pages does not allow me to use more than one category for each case study.
I have come to the conclusion that using a Case Study CPT with taxonomies for the categories is the best solution, would you agree?As far as using the page_team.php file, you would need to modify the code in †he template to do this as it uses WP_Query.
For the above scenario I would like to create a CPT archive template which produces identical output to page_team.php, ie using custom fields/ACF rather than the typical archive page output. Do you have any tutorials relating to this?
June 30, 2018 at 10:56 pm #221268Brad DaltonParticipant1. I have come to the conclusion that using a Case Study CPT with taxonomies for the categories is the best solution, would you agree?
Standard posts and categories are the easiest to work with however provided you have the templates i linked to, you can fairly easily create your own custom taxonomy types for a CPT. Personally, i would use standard posts and categories.
2. I don't have any tutorials for this at the moment. A custom template would take some time to code, test and then publish. You could try yourself using the page_team.php file.
Note : Also, it would be hard to code the template which includes ACF fields you need without setting up the ACF inputs using your json export.
July 2, 2018 at 12:16 pm #221286canpress5MemberThank you for your insight Brad!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.