• Resolved misterjakes

    (@misterjakes)


    I’m not sure how to posit this question, so if i don’t make sense, let me know.

    I have a wordpress blog that features regular humor posts.

    But my other interest is weightlifting and I’d like to semi-regularly do posts specifically about that topic and just share them with friends. These posts appearing on the front page with humor will really confuse my regular humor readers.

    So I want to be able to categorize those posts as “weight training” and have them appear on that category page, but not on the front page. That way I could just refer my friends to that category for the latest weightlifting news.

    Is this possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter misterjakes

    (@misterjakes)

    Wow. Thanks esmi, that’s exactly what I needed. It’s working great.

    I placed the code before the loop (in my template I think this is called “above the loop”) and that seems to have done the trick. But if my placement of the code seems wrong to you, please let me know.

    Again, thanks!

    Sounds like you added it in just the right place (ie just before <?php if (have_posts()) : while (have_posts()) : the_post(); ?>).

    It’s also worth noting that you can exclude individual posts on the fly using custom fields.

    After the_post line of your loop, you could add:

    <?php $exclude = get_post_meta($post->ID, 'exclude', $single = true);
    if(!$exclude){ ?>
    /* Post content here */
    <?php } ?>

    This will check for the absence of the custom field named “exclude” in each post. If it doesn’t find it, it inserts the post as normal. In the post, if you wanted it to be excluded from the front page, you would simply add a custom field named “exclude” and type anything in the value box.

    I know that’s not actually what you’re after, but someone might find this post searching for this particular query.

    John

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘need some posts not to appear on front page’ is closed to new replies.