• 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

Set up a blogroll with custom post types

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 › Set up a blogroll with custom post types

This topic is: not resolved

Tagged: archive, Custom Post Type, page

  • This topic has 1 reply, 2 voices, and was last updated 9 years, 4 months ago by Victor Font.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • July 17, 2016 at 7:28 am #189327
    David Borrink
    Participant

    I need a little help. I've set up a custom post type of "project" on my site, and I want to duplicate the blog roll from my site in order to just show this custom post type as the listings. This is my first attempt at creating a page template using Genesis, after doing this the normal WP way for years.

    I set up a page template called "page_product.php" and below is the code for that template. Source of that code is here. It's a four year old post, so I question if it's up-to-date now. Actually, my first couple pages of Bing search results have a lot of sites with info that is three or four years old. So I'm now questioning if I'm getting good info at all.

    I created two test "project" posts with featured images and text. I thought I would get this result: the page title, the page content, then I'd get a blog roll of the "project" posts below it. But I get an unformatted title for the page, no content, then immediately the two posts with only the featured image, meta, and short content, and the read more button.

    <?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();

    I have the Genesis Grid Loop plug-in installed, and I've set it for the main blog roll to have two columns of posts. In the dashboard I went to the Grid Loop settings and made sure that "project archives" was ticked so that the Grid Loop would apply to that. But I'm getting single column results.

    I assumed this was going to be a function that would would just create a duplicate two column grid on the "Portfolio" page that matched the look of the "Blog" page. See those links for reference.

    So I'm asking for a few minutes of someone's time to help me know if I'm in the right direction or if I'm way off here. I want to learn this, but there must be something I'm not getting here. Thanks.

    http://davidandsallie.com/portfolio/
    July 17, 2016 at 3:33 pm #189714
    Victor Font
    Moderator

    The WordPress query executes before the Genesis Loop. The loop simply displays the results of the query. If you want to display a specific post_type, you have to use WordPress filters. This should work if you apply it to your page_template. If not, you have to add it to functions.php and place a conditional wrapper around the query->set so it only executes for the project page template.

    function vmf_query_filter($query) {
    	$query->set( 'post_type', array('project') );
    	return $query;
    };
    add_filter('pre_get_posts', 'vmf_query_filter');

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 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

© 2025 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