Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- }
- function gen21_display_most_viewed_posts($smallthumbs = true) {
- global $wpdb;
- /* taken from wp-postviews.php by Lester Chan http://lesterchan.net/portfolio/programming/php/ */
- $favourites = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND post_type = 'post' AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT 4");
- if (!$favourites) return false;
- foreach ($favourites as $fav) { ?>
- <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 item">
- <a class="front-item" href="<?php echo get_permalink($fav); ?>">
- <?php
- echo get_the_post_thumbnail($fav, 'thumbnail');
- /*
- if ($smallthumbs) {
- echo get_the_post_thumbnail($fav, 'small');
- } elseif ( has_post_thumbnail($fav) ) {
- if (rand(0,1) == 1) {
- echo get_the_post_thumbnail($fav, "medium");
- }
- else {
- echo get_the_post_thumbnail($fav, "small");
- }
- } */ ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement