Pretty Pictures – Custom Homepage Loop

Community Forums Forums Design Tips and Tricks Pretty Pictures – Custom Homepage Loop

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  davidzumini 1 year, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13997

    davidzumini
    Participant
    Post count: 4

    I’m using the “Pretty Pictures” theme for a new blog I’m designing and I’d like to create a custom loop for the homepage. Basically, I’m using the Genesis Responsive Slider to highlight posts categorized as “Featured”. What I’d like to accomplish is to have the loop on the homepage show all posts except those categorized as featured, so as to avoid duplication. What file do I need to edit (or add) in order to make this happen?

    Thanks in advance!

     

    David

    #14005

    davidzumini
    Participant
    Post count: 4

    And… I answered my own question courtesy of Bill Erickson’s helpful site! In case anyone else is wondering, add the following to your child theme’s functions.php:


    add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );
    function be_exclude_category_from_blog( $query ) {
    if( $query->is_main_query() && $query->is_home() ) {
    $query->set( 'cat', '-1' );
    }

    where ‘-1′ is the category id you wish to exclude (be sure to keep the – in there in order to exclude it!).

    This seems to do the trick, but if anyone else has a way they think is better for some reason, I’m all ears. Thanks.

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

You must be logged in to reply to this topic.