Epik – Exclude Categories on Home Page

Homepage Community Forums Epik Theme Support Epik – Exclude Categories on Home Page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #19487
    Chris
    Customer

      Wes,

      Is there a way to exclude certain categories on the home page for the Epik theme?

      Thanks!

      Chris

      #19494
      Wes
      Moderator

        Which categories are you referring to? The Menu? If so, I’m not sure how to do that, I’ve never seen it done before in Genesis. It may be possible, just not sure how to do it.

        I do however know how to hide them using CSS so it shows on every page except the homepage. Is that something you’re interested in?

        #19495
        Chris
        Customer

          No, I meant in the blog loop on the home page. Would love to only include certain categories.

          I’m not sure where the loop is called in the theme. Could remove & replace with one with category filtering.

          Thanks!

          #19507
          Wes
          Moderator

            I haven’t done this before, but let me take a look and see if I can figure out a way to do it.

            It’s located in the front-page.php file as well as the customize.php file in the lib folder if you wanted to take a look at the code.

            #19508
            Chris
            Customer

              Thanks, Wes!

              #19585
              Wes
              Moderator

                I found this from a tutorial. Try adding this to your functions file and replace -1 with the categories you want to exclude –

                /** Exclude certain category from posts */
                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' );
                    }
                }
              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.