这是一个创建于 4555 天前的主题,其中的信息可能已经有所发展或是发生改变。
折腾wordpress,想在侧栏显示一个按有最新评论排列的文章的列表。有点类似论坛的排序方式,
代码如下,但是文章对应的评论数量调不出来...
另外,我还想把文章对应的最新评论时间也显示出来,应该怎么写呢?比如:**分钟前评论了
新人求助,谢谢哦^_^
<?php $pop = $wpdb->get_results("SELECT DISTINCT comment_post_ID FROM $wpdb->comments WHERE comment_approved = 1 AND comment_post_ID NOT IN ( SELECT ID FROM $wpdb->posts WHERE post_type != 'post' OR post_status != 'publish' OR post_password != '' ) ORDER BY comment_date_gmt DESC LIMIT 6"); ?>
<?php foreach($pop as $post) : ?>
<li class="post-thumb">
<span class="post-thumb-number"><?php wp_count_comments( $post->comment_post_ID ); ?></span>
<span class="post-thumb-image"><a href="<?php echo get_permalink($post->comment_post_ID); ?>" title="<?php echo get_the_title($post->comment_post_ID); ?>"><?php $thumbID=get_the_post_thumbnail($post->comment_post_ID,array(30,30),$imgsrcparam); ?><?php echo "$thumbID"; ?></a></span>
<span class="post-thumb-title offset"><a href="<?php echo get_permalink($post->comment_post_ID); ?>" title="<?php echo get_the_title($post->comment_post_ID); ?>"><?php echo get_the_title($post->comment_post_ID); ?></a></span>
</li>
<?php endforeach; ?>
1 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
GASALA 2012-06-06 11:23:54 +08:00
^_^有人愿意帮忙看一下吗
|