Forums

comment are not showing for the right post.. its showing comment of other post (2 posts)

  1. cjmling
    Member
    Posted 1 year ago #

    on single.php i modify a bit of code...

    I modify such that it can show five more post of the same category of the original post ... This is the code I added

    $category = get_the_category();
    		$args = array( 'numberposts' => 3,'offset'=> 1, 'category' => $category[0]->cat_ID );
    		$lastposts = get_posts( $args );
    		foreach($lastposts as $post) : setup_postdata($post); ?>
                    <?php endforeach; ?>

    So now that single.php post will print

    Original post ( which is suppose to be there on that post page by default )
    1st post from the same cat
    2nd post from the same cat
    3rd post from the same cat

    So now come the comment part. I expected it to display the comment done to the the original post .....

    but the problem is that it always show the comment done to the last post display over there which is the 3rd post here in my example..

    No matter which ever post I view of that category it will shows the comment of the last post displayed over there..

    How I can fix this ?

  2. cjmling
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic