pepperama
Member
Posted 2 years ago #
I am using the Woothemes Gazette theme on my site and i cannot get the "popular" tab to display any results. my site is http://www.eastkeilorfc.com
Even after changing the theme to Busy Bee and Daily Edition i am having the same proble. The other tabs work but nothing under Popular.
Can anyone help?
well its suppose to display the most popular post by amount of views it gets right, go edit your theme i think it should be in the sidebar to see if theres any code placed in the popular tab or check if you didn't activate something.
pepperama
Member
Posted 2 years ago #
I have checked. This is the code from the "Popular" function -
<?php
$pop_posts = get_option('woo_popular_posts');
if (empty($pop_posts) || $pop_posts < 1) $pop_posts = 8;
$now = gmdate("Y-m-d H:i:s",time());
$lastmonth = gmdate("Y-m-d H:i:s",gmmktime(date("H"), date("i"), date("s"), date("m")-24,date("d"),date("Y")));
$popularposts = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'stammy' FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish' AND post_date < '$now' AND post_date > '$lastmonth' AND comment_status = 'open' GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT ".$pop_posts;
$posts = $wpdb->get_results($popularposts);
$popular = '';
if($posts){
foreach($posts as $post){
$post_title = stripslashes($post->post_title);
$guid = get_permalink($post->ID);
$custom_field = get_post_meta($post->ID, "image", true);
?>
<?php if($custom_field) { ?>
" href="<?php echo $guid; ?>"><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo $custom_field; ?>&h=35&w=35&zc=1&q=95" alt="<?php echo $post_title; ?>" class="thumbnail" />
<?php } ?>
" title="<?php echo $post_title; ?>"><?php echo $post_title; ?>
<div style="clear:both"></div>
<?php
}
}
?>
Does this shed any light?