WordPress.org

Ready to get started?Download WordPress

Forums

Help with " most popular comment " plug in...please (3 posts)

  1. wonderla
    Member
    Posted 7 years ago #

    I downloaded and installed to my folders the plugin - which is just a file basically- for "most popular comments". yeah ,at least I did that.

    The problem is that when installed to my side bar the <b> things are still outside all the links.

    look at my sidebar - http://wonderlandornot.net

    here is the code inserted into the sidebar as directed

    <ul>
    <li><h2>Most Commented Posts</h2></li>
    <?php get_mostcommented(); ?>
    </ul>

    I've tried taking out the "ul" the "li" and the "h2" tags seperately and all together but it makes no differene.

    The code for the page is as follows - after the line that is not inclusive to the code

    ---------------------------

    <?php
    /*
    Plugin Name: WP-MostCommentedPosts
    Plugin URI: http://ja.rafi.pl/2006/05/01/wp-most-commented-posts/
    Plugin Description: WP-MostCommentedPosts plugin by Rafal "RAFi" Krawczyk based on <a href="http://dev.wp-plugins.org/wiki/wp-stats">WP-STATS</a> Statistics Plugin for WordPress written by <a href="http://www.lesterchan.net/">Lester "GaMerZ" Chan</a>.
    Version: 0.1
    Author: Rafal "RAFi" Krawczyk
    Author URI: http://ja.rafi.pl/
    */

    function get_mostcommented($limit = 10) {
    global $wpdb, $post;
    $mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date_gmt < '".gmdate("Y-m-d H:i:s")."' AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_total DESC LIMIT $limit");
    foreach ($mostcommenteds as $post) {
    $post_title = htmlspecialchars(stripslashes($post->post_title));
    $comment_total = (int) $post->comment_total;
    echo "<li>&raquo <a href="".get_permalink()."">$post_title</a> - $comment_total </li>";
    }
    }
    ?>

    the good thing is I actually installed something - the bad thing is that it has those "b" tags around it.

    Any help appreciated.

    Permanent link to my sidebar offered for help. I get a fair amount of traffic even though I am only a c list blogebrity.

    Are bribes illegal?

    my email is nowickedwitch@gmail.com

  2. yosemite
    Member
    Posted 7 years ago #

    2 approaches I can think of:

    1) Find out where the <b> is getting in there; Is it actually in the database? You using it in the titles (bad girl! go to my room!)? Search and Destroy!

    2) Give up like a feckless wimp and add .strip_tags(get_permalink()). to the plugin (line starting with echo near the bottom)?

    Problem with number 2 is <b> isn't even valid xhtml so if it pops up elsewhere/again.....

  3. wonderla
    Member
    Posted 7 years ago #

    Well unfortunately now my site is gone.;(

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags