Custom POST type template

Community Forums Forums General Discussion Custom POST type template

This topic is: not resolved


This topic contains 6 replies, has 2 voices, and was last updated by  streetfire 2 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #54789


    I’ve been using Genesis for a while. For the most part I love it… except when it comes to custom post type templates. I’ve done a lot of research and I just can’t seem to make anything work. Currently I’m using the Outreach theme.

    This is what I need to do:

    – Create custom single post (not page) template and reconstruct the layout of the post. For example I want to re-position the featured image, body content, add custom fields, etc.

    I am familiar with doing this in standard WordPress templates, but Genesis does not handle it the same.

    Can anyone shed some light? Thanks.



    You need to manage the custom post type template with the Genesis hooks. You just turn them on or off to get the layout you want for your page. And if sometimes, it’s easier for you to do certain things with WordPress code, like custom loops, for instance, that works too. You can find nearly anything you need to know by using Google search with genesis at the beginning.

    This tells you how to use hooks:

    This is where the hooks are located:

    And Nick has lots of info on hooks (as do others).

    Here is my sample to get you started. Basically all I left was the title, and then I replaced the content area with the custom post type content.

    This is the template for the single supporter custom post page – single-supporter.php
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );
    remove_action( ‘genesis_after_post’, ‘genesis_get_comments_template’ );
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_content’ );
    add_action( ‘genesis_post_content’, ‘c3_supporter_post_content’ );
    function c3_supporter_post_content() {
        global $post; // Needed or get_post_meta won’t return data
        $logo = get_post_meta($post->ID, ‘_ccc_logo_id’, true);// Note the _id
        $description = get_post_meta($post->ID, ‘_ccc_description’, true);
    //This is from Bill Erickson on GitHub for Custom MetaBoxes
    	if ( $logo ) :
            $logo_thumbnail = wp_get_attachment_image_src( $logo, ‘supporter-thumbnail’ );
         	echo &#8216;<img />&#8216;;   
    		echo &#8216;&lt;div class=&quot;supporter-info&quot;&gt;';
    	if ($description) {
    		echo &#8216;&lt;p&gt;&lt;span&gt;About:&lt;/span&gt;&lt;/p&gt;';
    		echo &#8216;&lt;p&gt;&#8217;. $description .'&lt;/p&gt;';
    		echo &#8216;&lt;/div&gt; &lt;!&#8211; end .supporter info &#8211;&gt;';
    } //End function c3_supporter_before_post_content

    Note: There are underscores in the code that aren’t showing in my browser, so you may need to copy the code into an editor to see it better.

    • This reply was modified 2 years, 3 months ago by  Marcy.
    • This reply was modified 2 years, 3 months ago by  Marcy.


    Hi Marcy, thanks very much for that information and the sample code. I plugged it into my site and am looking at it know. A great kickstart. Thank you.



    I’m glad it’s helping. I forgot to add that the method I used for creating the custom post type uses get_post_meta to retrieve the custom fields. Some plugins/methods use the_field or get_the_field.



    Marcy, do you by change have any suggestions for doing this same exact thing for a custom post type archive template? I.e. archive-customposttype.php.

    The code above doesn’t seem to do it.



    Are you using a plugin to create your custom post type? Or are you creating it yourself in your functions.php?

    What do you want in your archive page? Just a list of custom post types?



    Yes I am using a plug in called CustomPress from Basically yes, I’d like to pull a list of the custom post types and have the featured image, excerpt, and a read more link. My goal is mainly to re-arrange the layout of those items.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.