logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

This is an old version of this answer!

Return to the current answer
Try this (I haven't tested it yet):


//Get your latest post in a category:
$args = array('cat' => 4,
'showposts' => 1,
'orderby' = 'date');
query_posts($args);

if (have_posts()) : while (have_posts()) : the_post();
$args = array('post_ID' => $post->ID,
'status' => "approve",
'order' => 'ASC',
'number' => 1);
$comment = get_comments($args);

if(!empty($comment)) {
?>
<a href="<?php get_comment_link($comment[0]->comment_ID) ?>"><?php the_title(); ?></a>
by <a href="<?php $comment[0]->comment_author_url; ?>"><?php $comment[0]->comment_author; ?></a>
<?php } else { ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
by <?php the_author() ?>
<?php
}

endwhile; endif;


Lew

Lew Ayotte | 07/13/10 at 10:05am

This is an old version of this answer!

Return to the current answer