• recosc

    (@recosc)


    Hi guy.at first you made a good work on this theme.
    I ha ve a question . is it possible for the home page to display somes post a selected category ?

    I want to display on home page only the post form one specific category not All. is it possible to do that with your theme? how ?

    • This topic was modified 7 years ago by recosc.
Viewing 1 replies (of 1 total)
  • Mohammad

    (@osmikh)

    Hi there,

    I wanted to exclude one category and I added this code to my child theme functions.php where 999 is the category id to exclude.
    You can do the same or try a plugin e.g.
    https://www.ads-software.com/plugins/ultimate-category-excluder/

    function exclude_category( $query ) {
        if ( $query->is_home()  ) {
            $query->set( 'cat', '-999' );
        }
    }
    add_action( 'pre_get_posts', 'exclude_category' );
Viewing 1 replies (of 1 total)
  • The topic ‘Display post from one category on home page’ is closed to new replies.