Support » Fixing WordPress » How to add new posts but prevent them appearing on blog homepage

  • Resolved nottinghamjazz

    (@nottinghamjazz)


    I have a blog for my band.

    I also want to add non-band related posts to my blog (to drive more viewers to my site) but I don’t want those unrelated posts to appear on the homepage of the blog. When a user views my blog I want only the relevant band posts to appear on the homepage.

    How do I suppress some posts from being added automatically to the top of my blog homepage, but still make those posts indexable (and hence googleable) ?

    Does this question make sense? Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use categories to accomplish this. Use a separate category for the non-band related posts and then edit the code to exclude that category from the main page.
    http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

    to display posts from all categories except category_id 18:
    in /wp-content/themes/your theme/index.php

    .....
    <?php if (have_posts()) : ?>
    <?php if (is_home()) query_posts("cat=-18"); ?>
    <?php while (have_posts()) : the_post(); ?>
    ....

    Wow that was super smart. I found all I needed to add was:

    <?php if (is_home()) query_posts("cat=-5"); ?>

    beneath the <?php if (have_posts()) : ?> and before the <?php while (have_posts()) : the_post(); ?> lines at the top of my default theme index.php

    Thank you for your help!

    Good trick, just what I was looking for to prevent posts with video from appearing on my main page!

    Many thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add new posts but prevent them appearing on blog homepage’ is closed to new replies.