• Hi all,

    i’m playing with my first wp template and i would to have a latest 5 generic comments about all of my posts. Looking the functions reference page i’ve found a function that seems to solve my problem, get_comments() but it doesn’t work fine or.. how i think that it should works !

    i’m using this code:

    <?php
    	$args = array ( 'number' => 5 );
    	$mycomments = get_comments( $args );
    	foreach( $mycomments as $comment ) : setup_postdata($comment);
    ?>
    <li class="cat-item"><a>"><?php the_title(); ?></a>
    	<?php endforeach; ?>

    but i receive this message:
    Notice: Undefined property: stdClass::$ID in /home/public_www/0code.it/www/wp-includes/query.php on line 3592

    for more times, and 5 times the same comment, so the comments by id = 1 “Hello world!”.

    How can i solve my problem ?? is there anyone that have some ideas or hints to give me ??

    thanks 😉

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Lastest 5 comments’ is closed to new replies.