久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      如何按評論數(shù)量顯示前100名評論者

      下面由WordPress建站教程欄目給大家介紹按評論數(shù)量顯示前100名評論者的方法,希望對需要的朋友有所幫助!

      如何按評論數(shù)量顯示前100名評論者

      如想看看自己博客上哪位博友的留言評論最多及最后的評論時間,下面一段代碼會幫你實現(xiàn)這個功能。

      可以將下面代碼添加到當(dāng)前主題functions.php中:

      function top_comment_authors($amount = 100) {     global $wpdb;         $prepared_statement = $wpdb->prepare(         'SELECT         COUNT(comment_author) AS comments_count, comment_author, comment_author_url, MAX( comment_date ) as last_commented_date         FROM '.$wpdb->comments.'         WHERE comment_author != "" AND comment_type = "" AND comment_approved = 1         GROUP BY comment_author         ORDER BY comments_count DESC, comment_author ASC         LIMIT %d',         $amount);     $results = $wpdb->get_results($prepared_statement);     $output = '<ul class="top-comments">';     foreach($results as $result) {         $output .= '<li class="top-comment-author"><strong> <a href="'.$result->comment_author_url.'" target="_blank" rel="external nofollow">'.$result->comment_author.'</a></strong> 共'.$result->comments_count.' 條評論,最后評論 '.human_time_diff(strtotime($result->last_commented_date)).'前</li>';     }     $output .= '</ul>';     echo $output; }

      調(diào)用代碼:

      <?php top_comment_authors(100); ?>

      將代碼添加到WordPress主題模板適當(dāng)位置即可,其中的數(shù)字100可以控制顯示數(shù)量。

      贊(0)
      分享到: 更多 (0)
      ?
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號