Support » Fixing WordPress » Suppress certain posts from showing in the front page?

  • I don’t want certain posts to occupy the front page, eve if they are the latest.

    Is there any way that I can just assign a new post to a category, and prevent them from showing on the front page?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Yup. Include this before the loop in index.php

    <?php
       if (is_home()) {
          query_posts("cat=-x");
       }
    ?>

    where x is the ID of the particular category.

    I can’t seem to find the category IDs in WordPress 2.5… where would I find them?

    Nevermind, I figured it out.

    seriously, with how useful cat IDs are, hiding them in 2.5 was a really stupid move.

    You can get a plugin to put them back if you don’t want to hover over each and check the status bar… but who’s to say the plugin will work 2 versions from now?

    maybe i´m being really dense but I tried that code and I just get an error 🙁 … this is what i have in index.php :

    <?php
       if (is_home()) {
          query_posts("cat=-15");
       }
    ?>
    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wordpress/wp-blog-header.php');
    ?>

    britneyspy, you need to add the code to the Main Index Template (index.php) in the Admin control panel > Design > Theme Editor.

    Add the code right after <div id="content" class="posts"> so it looks like this: `<div id=”content” class=”posts”>

    <?php
    if (is_home()) {
    query_posts(“cat=-15”);
    }
    ?>
    `

    Hope this helps!

    When I do this, it causes my “Older Posts” button at the bottom of my main page to just keep people on the main page…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Suppress certain posts from showing in the front page?’ is closed to new replies.