Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 specific posts on home page as it is not taking the category attribute.

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

share|improve this question

2 Answers 2

Also using query_posts() is highly discouraged. If you need a second loop, use new WP_Query() or if you want to adjust the main loop then use pre_get_posts. If you home page is not a static page, then this should work regardless of what theme you use. (Goes in functions.php... preferably a child theme if you are working with a framework)

function wpa84417_include_cat( $query ) {
    if ( is_home() && is_main_query() ) {
        set_query_var( 'cat', '33' );
    }
}
add_action( 'pre_get_posts', 'wpa84417_include_cat' );
share|improve this answer

First - Do not alter the core.

Second - These links may help you with what you need to achieve.

  • Display posts from specific category, tag on page in Genesis

    By default, WordPress generate pages for all tags and categories automatically. If you click specific category page (like site.com/category/guide), it will display all posts ‘date-wise’ from that category. You can easily transform (site.com/category/guide) to (site.com/guide) by removing “/category” from the url slug by using specific plugin. However, Genesis users can do this without plugin using small code with possibility of variety of combinations.

  • 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.