• Resolved Amanda_a

    (@amanda_a)


    Thank u for ur time first and foremost!

    My wordpress posts are split into categories. When u arrive at a specific post in the sidebar I’m trying to display more posts from that same category.

    I am using:
    query_posts("showposts=3&orderby=rand&cat='.$category_id");

    Where $category_id is defined here:

    <?php
    
    foreach((get_the_category()) as $category) {
    $category_id = $category->cat_ID . '';
    $category_name = $category->cat_name . '';
    	}
    ?>

    The problem is that I notice the post I am viewing appearing in the randomly generated query on my sidebar. Is there a way to ensure the post I am on doesn’t appear within this query?

    The beta can be seen here: Beta

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘More posts from same cat -current one?’ is closed to new replies.