Most Popular Side Bar script
-
The sidebar is pulling the correct posts based on the comment count, but for the excerpt it is pulling the wrong one and repeats the same content for each entry. Basically the post excerpt doesn’t match the title.
here is the functions side bar layout–don’t see anything wrong here, though
// Get list of most popular Posts to display it in sidebar
function show_popular_posts($numberposts=5) {
global $wpdb;
$result = $wpdb->get_results(“SELECT $wpdb->posts.post_title, $wpdb->posts.ID, $wpdb->posts.post_content FROM $wpdb->posts WHERE $wpdb->posts.post_status = ‘publish’ AND $wpdb->posts.post_type = ‘post’ ORDER BY $wpdb->posts.comment_count DESC LIMIT $numberposts”, OBJECT);
foreach($result as $post) {
echo ‘<div class=”Post” style=”margin:0;”><div class=”Post-body”><div class=”Post-inner article”><div class=”PostContent”>’;
echo ‘<div style=”height:55px;margin:0 0 10px 0″>’;
$image = get_post_meta($post->ID, ‘thumb’, true);
if ( $image == ” ) $image = ‘https://i208.photobucket.com/albums/bb168/BOptiz/wp.png’;
?>
<div style=”float:left;”>
ID); ?>”>
<img class=”alignleft” style=”padding:3px;margin:3px 5px 0 0;height:50px;width:50px;” src=”<?php echo $image; ?>” alt=”<?php echo $post->post_title; ?>” />
</div>
<h2 style=”margin:0;padding:0;font-size:90%;text-align:left;”>ID); ?>”><?php echo $post->post_title ?></h2>
<div style=”margin:-10px 0 0 0;padding:0;font-size:85%;text-align:left;”>
<?php if(function_exists(‘the_content_limit’)) the_content_limit(90, “More”); ?>
</div>
</div></div></div></div></div>
<?php
}
}I only am showing one post at the bottom of the right-side bar so you can see the error.
website address: https://www.philliesdigest.com
there is no support for this free theme by SpiderWP.com
- The topic ‘Most Popular Side Bar script’ is closed to new replies.