WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

May 31 2011

How to Display Posts from a Specific Category using Genesis Grid Loop

To display posts from a specific category or categories, you need to add a 'cat' argument to the $grid_args array. StudioPress gives a good introductory tutorial, How to Use the Genesis Grid Loop, on how to set this up.

In the StudioPress tutorial, you are given this example for your home.php.
[php highlight="17"]<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
/** Add support for Genesis Grid Loop **/
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 2,
'feature_image_size' => 0,
'feature_image_class' => 'alignleft post-image',
'feature_content_limit' => 0,
'grid_image_size' => 'grid-thumbnail',
'grid_image_class' => 'alignleft post-image',
'grid_content_limit' => 0,
'more' => __( '[Continue reading...]', 'genesis' ),
'posts_per_page' => 6,
'cat' => '6,7' //enter your category IDs here separated by commas in ' '
) );
} else {
genesis_standard_loop();
}
}

/** Remove the post meta function for front page only **/
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

genesis();[/php]

Written by Travis Smith · Categorized: Genesis, Genesis Grid Loop, Tutorials

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Comments

  1. alex says

    March 24, 2012 at 1:41 pm

    So, Travis, this is awesome and works well for me. However, in some cases rather than picking categories to include, you’d rather just exclude a category or two. What’s the syntax to exclude a category?

    Alex

    Reply
  2. lavi says

    February 4, 2013 at 5:20 am

    Hello!
    actually i have used this code but my problem is not resolved.
    my site has genesis framework and a child theme. i want to show specific category posts on my home page content area. i used the simple post query

    query_posts(‘post_status=publish&cat=33&wp_get_recent_posts()’);
    in my genesis/lib/structure/loops.php file right above the do_action( ‘genesis_before_post’ );
    but it makes no sense .
    so at last i used this grid loop but using this i am still unable to show category specefic posts on home page as it is not taking the category attribute.
    can u help me that how can i show specific category posts on my home page .

    the main problem is this : by clicking on a particular post link the post doesn’t open on a saparate page it redirects to the same page.

    can anyone help me regarding this???

    Reply
  3. lavi says

    February 4, 2013 at 5:33 am

    Hello!
    actually i have used this code but my problem is not resolved.
    my site has genesis framework and a child theme. i want to show specific category posts on my home page content area. i used the simple post query

    query_posts(‘post_status=publish&cat=33&wp_get_recent_posts()’);
    in my genesis/lib/structure/loops.php file right above the do_action( ‘genesis_before_post’ );
    but it makes no sense .
    so at last i used this grid loop but using this i am still unable to show category specefic posts on home page as it is not taking the category attribute.
    can u help me that how can i show specific category posts on my home page .

    the main problem is this : by clicking on a particular post link the post doesn’t open on a saparate page it redirects to the same page.

    can anyone help me regarding this???

    Reply
  4. Brandon Kraft says

    March 4, 2013 at 3:26 pm

    FYI for everyone: This is now superseded by this excellent tutorial by Travis:
    https://wpsmith.net/2013/genesis/genesis-grid-loop-in-genesis-1-9/

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in