[resolved] Automatically Don't Post on Home Page (5 posts)

  1. jackmcnally
    Posted 3 years ago #


    I have categories that people will be posting in (I restricted posting to these categories for certain users), and I don't want those posts to show up on the home page. There will be a large amount of posters, so asking them to check a box every time they post may be hard. Is there a way for posts to automatically not show up on the homepage, but show up on the homepage if I tick a box, or post in a certain category?

    Sorry if you don't understand, I don't know how else to say it, let me know if you need more info!

    Thanks heaps,

  2. Big Bagel
    Posted 3 years ago #

    To only include/exclude certain categories on the home page you can use query_posts().


    Something like this before the loop in your theme's index.php file would work (replacing the numbers with the ID's of the categories you want of course):

    if ( is_home() ) {
        global $wp_query;
        $args = array_merge( $wp_query->query, array(
            'category__in' => array( 27, 42 )
        ) );
        query_posts( $args );

    And as always, if you need to edit your theme and aren't doing this already, it's best to use a child theme.

  3. jackmcnally
    Posted 3 years ago #


    I did so on my index.php , but to no avail. It seems to be what I want to do, but is not working. I'm unsure as to if index.php is the right place to put it, all the index.php file says is <?php // Silence is golden? ?> . I'm using the mystique theme, if that helps.


  4. Big Bagel
    Posted 3 years ago #

    Never seen a theme that didn't use index.php at all. Awesome sauce.

    Try home.php instead. It looks like that's where the loop that runs on the home page lives.

  5. jackmcnally
    Posted 3 years ago #

    No matter! I used a plugin called Exclude Categories from Front Page. It works perfectly! Thanks for all your help!

Topic Closed

This topic has been closed to new replies.

About this Topic