Top Articles code, please look
-
Hey guys!
The theme has its own Top Articles sidebar next to the featured section, its written into header.php. Its suppose to display articles with most comments, but it doesn’t – instead, it displays the most recent articles including DRAFTS, that are not even published. If you click that it obviously gives the 404 error, because there is no article published yet.
Can anyone help? Here is the code for Top Articles in header.php
<div class="top"> <span class="heading1"><span>Top Articles</span></span> <ul> <?php $kt=time()-1209600; $sql = "SELECT * FROM $wpdb->posts WHERE post_date_gmt > FROM_UNIXTIME(".$kt.") AND post_type = 'post' ORDER BY comment_count DESC LIMIT 5"; $top_posts = $wpdb->get_results($sql); foreach ($top_posts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span><a class="comments" href="<?php the_permalink(); ?>#comments"><?php echo $post->comment_count; ?> Comments</a>Posted Under: <?php the_category(', '); ?></span></li> <?php endforeach; ?> </ul> </div> <div class="clear"></div> </div>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Top Articles code, please look’ is closed to new replies.