Last active
July 6, 2018 05:24
-
-
Save onjee/6e1824a07182287776be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Популярные записи</h2> | |
<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 $post) { | |
setup_postdata($post); | |
$postid = $post->ID; | |
$title = $post->post_title; | |
$commentcount = $post->comment_count; | |
if ($commentcount != 0) { ?> | |
<li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"> | |
<?php echo $title ?></a> (<?php echo $commentcount ?>)</li> | |
<?php } } ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment