WordPress.org

Ready to get started?Download WordPress

Forums

Most Popular Side Bar script (4 posts)

  1. threio
    Member
    Posted 5 years ago #

    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 = 'http://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: http://www.philliesdigest.com

    there is no support for this free theme by SpiderWP.com

  2. threio
    Member
    Posted 5 years ago #

    <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>

    this portion appears to have the problem, when I removed it the only things that showed was the thumb and the correct title.

    why it pulls the same content excerpt is baffling, on top of that its the wrong for all of the entries.

    also - don't know if this matters, but, I am using super-cache plugin with the theme

  3. wp-lover
    Member
    Posted 5 years ago #

    Thanks for letting us know ; threio.

  4. threio
    Member
    Posted 5 years ago #

    I dumped this theme too many glitches in the code and nowhere to get help for the novice hack!

Topic Closed

This topic has been closed to new replies.

About this Topic