WordPress.org

Ready to get started?Download WordPress

Forums

Suppress certain posts from showing in the front page? (8 posts)

  1. thinkweird
    Member
    Posted 6 years ago #

    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?

  2. Len
    Member
    Posted 6 years ago #

    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.

  3. arwennn
    Member
    Posted 6 years ago #

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

  4. arwennn
    Member
    Posted 6 years ago #

    Nevermind, I figured it out.

  5. Ivovic
    Member
    Posted 6 years ago #

    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?

  6. britneyspy
    Member
    Posted 6 years ago #

    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');
    ?>
  7. thursfrisat
    Member
    Posted 6 years ago #

    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!

  8. Maldran
    Member
    Posted 5 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Topic