• Resolved moshu

    (@moshu)


    I know I saw it somewehere… just can’t find it ??

    I need a code snippet for a sidebar (query?) that would display the X number of recent posts in single post view – but from the same category as the post is in.
    Basically, the code should be smart enough to take the category of the viewed single posts and query the recent posts ONLY from that cat.

    Anybody remembers anything like that? Thanks!

Viewing 2 replies - 16 through 17 (of 17 total)
  • the plugin works great by the way although I had not exactly the same problem… thank you guys! ??

    Hi, I have to use JohnPope’s idea to add excerpt and thumbnails to that list, BUT the problem is that this code below just show other posts from the first category this post is found in. I need it changed to check all categories that current post is in and display the latest post found in any of these categories. Anybody know how to do that ? Pretty pliz

    `<?php
    global $post;
    $categories = get_the_category();
    $category = $categories[0];
    $cat_ID = $category->cat_ID;
    $myposts = get_posts("numberposts=8&category=$cat_ID");
    ?>
    <?php foreach($myposts as $post) :?>
    "><?php the_title(); ?>
    <?php the_thumb(); ?><?php the_excerpt(__('Read More'));?> " href="<?php the_permalink(); ?>">
    
    <?php endforeach; ?>
    
Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘recent posts from the same category’ is closed to new replies.