WordPress.org

Ready to get started?Download WordPress

Forums

simple recent comment plugin (4 posts)

  1. sfong15
    Member
    Posted 7 years ago #

    I'm trying to understand Raoul's simple recent comment plugin.

    In the sql query it has WHERE comment_approved = '1' AND comment_type='' AND post_password = ''. I was thinking that the database has stored type of comments in comment_type since I could use it in the loop such as this http://codex.wordpress.org/Template_Tags/comment_type

    However if I use comment_type='trackback' it doesn't work?

    Currently this plugin returns only comments but not trackback or incoming links, wonder if that can be done or some other plugins should be used.

  2. Chris_K
    Member
    Posted 7 years ago #

    Have a look at this article.

  3. jackosh
    Member
    Posted 7 years ago #

    yes, for each comment, a "comment type" is stored, however trackbacks and pingbacks are both stored as "trackbacks" (as far as I know). I wouldn't know how to go about seperating the pingbacks from trackbacks.

    Sorry :(

    If you don't mind trackbacks and pingbacks being together, you can follow the instuctions on this page (http://jackosh.com/wpplugins/trackbacklist/) to seperate them from regular comments..

  4. sfong15
    Member
    Posted 7 years ago #

    Firstly thanks HandySole for the hint. That article at Bram.us uses the same filter as in Jackosh's plugin, i.e. if(get_comment_type() != "comment") that returns anything else other than normal comment.

    I just wonder why using comment_type from WP's database doesn't work.

    E.g. in Anders Holte Nielsen's plugin to count number of comments, I have added additional query comment_type at the end and it works! I tested it OK, see this post

    global $wpdb;
    $s = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1' AND comment_type='pingback'";
    if ($a)
    { $s .= " AND comment_post_ID=$a"; }
    return $wpdb->get_var($s); //return number of pingbacks

Topic Closed

This topic has been closed to new replies.

About this Topic