• Hello,

    I’m having trouble trying to exclude the current post from my other posts sidebar. My code is as following.

      The Main Post

    `
    <div id=”col_1″>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div id=”col_1_top”>
    <h5>“><?php the_title(); ?></h5>
    </div>
    <div id=”col_1_bod”>
    <p><?php the_content(); ?></p>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>

      The Recent Posts

    <div id=”col_2″>
    <div id=”col_2_top”>
    <h5>Other Notices</h5>
    </div>
    <div id=”col_2_bod”>
    <?php query_posts(‘category_name=Notice&showposts=4’); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”col_item”>
    <h5>“><?php the_title(); ?></h5>
    <p><?php the_content(); ?></p>
    </div>
    <?php endwhile; ?>
    <?php wp_reset_query(); ?>
    </div>
    </div>
    `

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Exclude current post when displaying recent posts in sidebar’ is closed to new replies.