Quantcast
Channel: Topic Tag: mobile | WordPress.org
Viewing all articles
Browse latest Browse all 22103

ubaidullahbutt on "Showing only the last 3 comments for a post / page"

$
0
0

I think you are put the code in your single.php.

Then use loop for this, like

$post_obj = new WP_Query($args);
while($post_obj->have_posts() ) : $post_obj->the_post();
    //display comments
    $comments = get_comments(array(
        'post_id' => $post->ID,
        'number' => '2' ));
    foreach($comments as $comment) {
        //format comments
    }
endwhile;

Also Check out this, in case you want comments from specific post.

http://codex.wordpress.org/Function_Reference/wp_list_comments#Display_Comments_for_a_Specific_Page.2FPost


Viewing all articles
Browse latest Browse all 22103

Trending Articles