(Moderator’s note: The original title was “How can I create create and use a custom template for custom post types in the Genesis theme framework?”)
I’m using the Genesis theme framework, with an almost completely ‘stock’ child theme. I have the WP Easy Post Types plugin installed, and have created one custom post type (“Members”). I have two custom fields created to use for the ‘member’ post type (phone number and address). I’m trying to figure out how to display the information from those fields in two places: example.com/members
and example.com/members/bob
. Genesis doesn’t support the typical single-posttype.php
file to create a template for the custom post type, but even if it did, that doesn’t take care of example.com/members
. Any suggestions on how to get the desired information to display?
Turns out I was wrong, Genesis does support using the
page_posttype.php
method of creating a custom template. It turned out to be very simple. Here’s the contents of my page_members.php file (located in the child theme folder):Take a look at how Matt Wiebe does it in his “Smarter Custom Post Types” plugin:
http://somadesign.ca/projects/smarter-custom-post-types/
The relevant function is here:
Could someone clarify the next step of this process? I have a similar custom post type in a Genesis child theme and need to change the loop on multi-post taxonomy pages as well as single custom post pages. Where does the custom code for the loop go in this case? Thanks!
This template needs to go into the child theme folder, though, not Genesis.
Edit:
You will need to manually create the single-$posttype.php and add it to the child theme as noted above. Please take a look at WordPress Template Hierarchy. It goes without saying anything you add to a child theme will override the parent theme files.