Forums

[resolved] PHP: Not display all posts on front page (2 posts)

  1. satori6
    Member
    Posted 2 years ago #

    Hi all,

    I am using the Grungezine theme, which is a 3 column magazine style theme. The very left column is programed to show every post I create, while the others to the right of it allow me define the category which they will display. However, this leads to each post showing up twice: once in the column that I want it to and once in the "home-entry" column. I want to define a category for this main column as well, but when I mess with the code, the whole site disappears.

    Here is what the PHP looks like there: (at least I think this is the relevant part)

    <div class="home-entry">
    <h2>What's New</h2>

    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; ?>

    <div class="post" id="post-<?php the_ID(); ?>">

    <h1>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></h1>

    This is what it looks like in the other column (where I defined category 4):

    <div class="news">
    <h2>Upcoming Events</h2>
    <div class="news-entry">
    <?php $my_query = new WP_Query('showposts=4&cat=4');
    while ($my_query->have_posts()) : $my_query->the_post();
    if ( $post->ID == $do_not_duplicate ) continue;
    update_post_caches($posts);
    $do_not_duplicate = $post->ID; ?>

    Is it possible to change this? I want to have 3 different subject columns.

    The site is: http://www.sattya.org/sattya

    Sorry if this is a ridiculous question or if I am forgetting some vital info. It's my first time delving into the world of programming (if that's what this is.

    Thank you. Your help is very much appreciated.

  2. satori6
    Member
    Posted 2 years ago #

    Finally found the answer here:

    http://codex.wordpress.org/The_Loop

    This section explains:

    Exclude Posts From Some Category

    This example can be used to exclude a certain Category or Categories from being displayed. In this case, posts from Categories 3 and 8 are excluded.

Topic Closed

This topic has been closed to new replies.

About this Topic