(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?
4 Answers
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):
<?php
/*
Template Name: Members
*/
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_loop');
function custom_loop() {
global $paged;
$args = array('post_type' => 'members');
genesis_custom_loop( $args );
}
genesis();