"More from this Category", excluding current post (1 post)

  1. multiplier
    Posted 8 years ago #

    In the sidebar of the the Mimbo theme, there is a module called "More from this Category". The relevant code is:

    <?php if ( is_single() ) :
    global $post;
    $categories = get_the_category();
    foreach ($categories as $category) :
    <li><h2>More from this category</h2>
    <ul class="bullets">
    $posts = get_posts('numberposts=10&category='. $category->term_id);
    foreach($posts as $post) :
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>

    Anyway, I'm building a similar module for my new theme, but unlike Mimbo, I want to exclude the current post from the list so there's no redundancy. Any simple way to do that?

Topic Closed

This topic has been closed to new replies.

About this Topic