当前位置: 首页 >> 网站建设 >> 正文

wordpress最多评论的代码


wordpress最多评论的代码
<div id=”mostcommented” class=”clearfloat”>
<h3>Most Commented</h3>
<ul><?php $result = $wpdb->get_results(”
SELECT comment_count,ID,post_title
FROM $wpdb->posts
ORDER BY comment_count DESC
LIMIT 0 , 5″);

foreach ($result as $topfive) {
$postid = $topfive->ID;
$title = $topfive->post_title;
$commentcount = $topfive->comment_count;
if ($commentcount != 0) { ?><li><a href=”<?php echo get_permalink($postid); ?>” title=”<?php echo $title ?>”><?php echo $title ?></a></li><?php } } ?>
</ul>
<?php /* Widgetized sidebar, if you have the plugin installed. */ if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar(6) ) : ?>
<?php endif; ?>
</div>

保存时要注意保存格式为UTF8


 

也许您对下面的内容感兴趣...

0 条评论 发表评论

留下回复

© 2007-2009 一杯茶 All Rights Reserved.   Powered by Wordpress