• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Setting up a blogroll with custom post types – sort of right, but…

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Setting up a blogroll with custom post types – sort of right, but…

This topic is: not resolved

Tagged: CPT, grid loop

  • This topic has 11 replies, 2 voices, and was last updated 9 years, 7 months ago by Brad Dalton.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • July 12, 2016 at 5:35 pm #189348
    David Borrink
    Participant

    I have set up a custom post type of "projects" on my site, and I want it's archive page to be the same look as my regular blog roll. I'm using the Genesis Grid Loop, so I get a two-column display of posts on my blog. I created an archive template called "page_project.php". I've set up the archive page to be called "Portfolio", have an introduction paragraph, then show the loop of posts.

    I found a set of codes (source link here) to create a template for it. It is supposed to allow a page's title and description to show up, then the loop begins to call up the posts of the new post type.

    Here is the code after I modified it to my post type...

    <?php
    /**
     * Template Name: Project Archives
     * Description: Used as a page template to show page contents, followed by a loop through a CPT archive  
     */
    
    // Do the Custom Loop
    remove_action('genesis_loop', 'genesis_do_loop');
    add_action( 'genesis_loop', 'ds_custom_loop' );
    
    function ds_custom_loop() {
    
    echo '<h1 class="entry-title">' . get_the_title() . '</h1>';
    the_content();
    //WP Query Start
    $per_page = 12;
    $project_args = array(
    'post_type' => 'project',
    'posts_per_page' => $per_page,
    'paged' => get_query_var( 'paged' )
    );
    $projects = genesis_custom_loop( $project_args );
    }
     
    genesis();

    The result? I get the page title, but the page description doesn't show. Then the loop begins, but it's not two column like my blog page. I get the featured image, the meta info, then no post title, but then I get the text with limited characters (correct), then the read more button. The overall result is sort of correct. It appears that I'm getting some of the results the same as the main blog display, but there are missing items. Not sure why it's not the same.

    I checked my Genesis Grid Loop settings and saw that I needed to tick the "project archives" under grid enabling. But that didn't change anything. The fact that that choice was there must mean I've got my custom post type set up properly (using Meta Box and MP Custom Post Type plugins, if that's informative for you to know).

    Here's my link to my Portfolio page, and my link to my http://davidandsallie.com/blog/ page for reference.

    This is my first attempt at a template using Genesis. I've been a TwentyTwelve template creator for years, so the "Genesis way" is new to me. As I understand it, all I'm doing here is changing the query. And the Genesis process is supposed to switch out the content, and I assume the Grid Loop should be displaying my content the same way. I would think I should get an identical display as my main blog page.

    My concern is that the source for this code is four years old. I did have to correct some characters for the < and > from the GitHub paste-up. Strangely, the first couple of pages of search results I got had posts that were 3 to 4 years old. That seems "ancient". Very surprised that I could not find any 2015 or 2016 posts in the first couple pages.

    Could I ask for a couple tips from someone? I know I'm heading in the right direction. My results are part-way there.

    http://davidandsallie.com/portfolio/
    July 12, 2016 at 6:58 pm #189351
    Brad Dalton
    Participant

    In short, you want a grid loop for your CPT?


    Tutorials for StudioPress Themes.

    July 12, 2016 at 7:34 pm #189354
    David Borrink
    Participant

    In a word... Yes.

    I'm not understanding if my CPT plug-ins don't talk with the Genesis Grid Loop plug-in, or what.

    July 12, 2016 at 7:48 pm #189357
    Brad Dalton
    Participant

    How many CPT's do you have?

    There's at least 3 ways to display CPT's or posts in columns.

    You can use CSS or PHP code which provides at least 2 different methods.


    Tutorials for StudioPress Themes.

    July 12, 2016 at 8:17 pm #189359
    David Borrink
    Participant

    I have one CPT. It's called "project". My theme comes with a nice style for the columns in the main blog. The Genesis Grid Loop plug-in does a nice job. I just want the CPT posts to match it. Figuring I had to check "project archives" in the Grid Enabling section of the dashboard would be enough.

    July 12, 2016 at 8:21 pm #189361
    Brad Dalton
    Participant

    I think you can use the Genesis grid loop plugin for your CPT archive page as well however its not the best solution in my opinion.

    I would use the Genesis Column Classes function you linked to with a conditional tag for your CPT archive.

    if ( is_post_type_archive('project'))
    

    Tutorials for StudioPress Themes.

    July 12, 2016 at 8:35 pm #189362
    David Borrink
    Participant

    How would that function be used? Do I put that in my template (see first post for the complete template)? Where and how would I use that? I don't recall having a Genesis Column Classes function in my code.

    July 12, 2016 at 9:07 pm #189365
    Brad Dalton
    Participant

    You can add it directly to your archive-project.php file without the conditional tag or in your functions file with the conditional tag.


    Tutorials for StudioPress Themes.

    July 13, 2016 at 5:53 am #189392
    David Borrink
    Participant

    First, you mention "archive-project.php", is this a new file I create? My template file is "page-project.php". Do I use "archive.php" from the lib/structure folder, copying it into my child theme? Or did you mean the "page-project.php" I have? (My rookie-ness with Genesis is clearly showing here.)

    Or if I'm to put it in my functions file, are you saying I just do this:

    <?php
    if ( is_post_type_archive('project'));
    
    // Do the Custom Loop
    remove_action('genesis_loop', 'genesis_do_loop');
    add_action( 'genesis_loop', 'ds_custom_loop' );
    
    function ds_custom_loop() {
    
    echo '<h1 class="entry-title">' . get_the_title() . '</h1>';
    the_content();
    //WP Query Start
    $per_page = 12;
    $project_args = array(
    'post_type' => 'project',
    'posts_per_page' => $per_page,
    'paged' => get_query_var( 'paged' )
    );
    $projects = genesis_custom_loop( $project_args );
    }
    
    endif;
    
    July 13, 2016 at 12:37 pm #189409
    Brad Dalton
    Participant

    No not that code. See here


    Tutorials for StudioPress Themes.

    July 13, 2016 at 8:24 pm #189433
    David Borrink
    Participant

    Okay, I just gave myself an education.

    Thanks to your using "archive-project.php" I was able to re-read something I found and was not aware that WP and Genesis had built-in template support via archive-[post-type].php templates. I found Carrie Dils' post on registering a custom post type and she explained the newer system.

    I removed my MB Custom Post type plug-in, wrote up a function to register the "project" post type, it picked up on my sample projects posts that were written with the plug-in, and gave me all the support I needed to set up the page simply by using the slug.

    Fascinating. And because it used the template hierarchy which I didn't understand until tonight, it fell back to the index.php template to make the display I needed to match my blog page. Perfect.

    I'm less of a Genesis rookie tonight. Problem solved.

    July 13, 2016 at 9:06 pm #189436
    Brad Dalton
    Participant

    You've learn't a lot from that!

    Now you can use CSS or PHP code to display your CPT entries in columns.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble