Sort by Comments

Description:

Adds some forum functionality to WordPress. Changes the order of posts so that the most recently commented posts show up first. Also displays last comment with the posts. Changes affect home page only. Intended for use with the Prologue theme (about), but should play nicely with other themes as well.

Download:

Fetch the latest version (0.1.1)!

Install:

  1. Download and unzip the plugin.
  2. Upload to /wp-content/plugins/
  3. Navigate to Dashboard > Plugins and activate the plugin

Changelog:

0.1.1
- Querys all posts and sorts them by [most recent comment | date published] (whichever is more recent) before displaying the home page
- Displays the last comment (if any) with each post on the home page
- Links to normal view instead of using pagination. (In normal view, pagination is same as always)

See also:

Filter By Comments: Adds query vars (`comment_count`, `comment_count_compare`, `orderby_last_comment`) for filtering posts by comments.

27 kommentarer

  1. Skrevet 20. mars 2008 klokka 18:46 | Permalenke

    favorited this one, bro

  2. Skrevet 27. mars 2008 klokka 9:40 | Permalenke

    Kirkns: Glad you liked it!

  3. Skrevet 21. februar 2009 klokka 11:54 | Permalenke

    Hello,

    I would like to first thank you for such an innovation! I really needed it.
    I just had a question, if I may. I would like the plugin to sort my posts by latest comment, but I would not like it to view the last comment on the front page or anything that wouldn’t show if I wasn’t using the plugin. I just would like it to change the order of posts, and let them show as it is.
    How can I do this?

    Thanks for your time,
    SA

  4. Skrevet 24. februar 2009 klokka 23:16 | Permalenke

    You’ll need to edit the plugin file. Near the bottom of the file, comment out the line

    add_filter('the_content','sbc_displayLastComment');

    Add two slashes at the start of the line, like this:

    // add_filter('the_content','sbc_displayLastComment');

  5. Skrevet 17. mars 2009 klokka 12:46 | Permalenke

    Nice Plugin, thanks for writing it! But i’m having a problem in WordPress 2.71 – it only shows many, many Versions of one post. Has anyone already succeded in porting it to WP 2.7? I believe that some comment-tables changed… Thanks again! M

  6. Skrevet 17. mars 2009 klokka 16:02 | Permalenke

    As far as I know, no forks(, ports or anything at all, really) exist. I can confirm that the plugin is not tested with 2.7.

    I would love to upgrade the plugin, but I can’t find the time just now. If anyone would like to help, please let me know.

  7. Seregey
    Skrevet 20. mars 2009 klokka 9:57 | Permalenke

    Is there any way to make this plugin work at whole blog (not only the main page)?

  8. Skrevet 20. mars 2009 klokka 10:24 | Permalenke

    Seregey: Not that I know of, sorry.

  9. Skrevet 9. april 2009 klokka 12:22 | Permalenke

    I’ve got a blog with 2100 entries and 5000 comments: I need this plugin but my blog became so slow! (cpu at 100%, 20 sec to rebuild home page)
    Is there a way to limit all the queries to the last 10 entries and the last last 20 comments?
    Is there any other ways to use this plugin with a large number of posts and comments?

  10. Skrevet 9. april 2009 klokka 18:05 | Permalenke

    Line 42 reads:

    while(have_posts()):

    To limit the plugin to search through the 10 latest posts, change it to:

    while( $postCounter<10 && have_posts() ):

    I’m pretty sure this plugin could be rewritten to scale better, but unfortunately I do not have enough time on my hands. Please let me know if you can use it for something useful!

  11. Bonsak
    Skrevet 24. juni 2009 klokka 13:21 | Permalenke

    Hi, I love your plugin. Would it be hard to modify it to also bump edited posts?

    Regards, Bonsak

  12. Skrevet 24. juni 2009 klokka 17:49 | Permalenke

    One way would be to add a custom field ‘bumped’, which could be set to the current time when a button is clicked.

  13. Paul Hamon
    Skrevet 29. juni 2009 klokka 8:30 | Permalenke

    Love the idea, now… I’m keen on sorting by meta_vale. I’ve using plugin that gives me expiration-date = 1248843600 in the postmeta table.

    my mysql is below average, how do i make this happen? :(

  14. Skrevet 13. juli 2009 klokka 2:57 | Permalenke

    I’m not quite sure I understand what it is that you want to do. Could you rephrase the question?

  15. bitkahuna
    Skrevet 27. juli 2009 klokka 9:17 | Permalenke

    on wp 2.8 your plug-in APPEARS to be showing post entries corresponding to pages too (all of which are in the same table). trying to figure out how to fix it…

  16. Skrevet 27. juli 2009 klokka 9:17 | Permalenke

    oops, i wanted to get notified so have to leave another comment, sorry. :-}

  17. Skrevet 27. juli 2009 klokka 12:33 | Permalenke

    Try something like this (I haven’t tested it, so you might have to debug it or do something else) from somewhere around line 42.

  18. bitkahuna
    Skrevet 30. juli 2009 klokka 4:55 | Permalenke

    thanks very much, but i found the bug, and it’s not what i thought it might be above.

    the problem is where you try to ‘fool’ wp into only displaying the posts per page – if there’s LESS posts in the blog than posts per page, you’re still telling it to display posts per page number. so my fix:

    // only do this if there's more posts in the blog that posts per page
    $ppp = get_option('posts_per_page');
    if (count($posts) > $ppp) {
        $wp_query->post_count=$ppp;
    }

  19. Skrevet 30. juli 2009 klokka 22:58 | Permalenke

    I’m glad you could sort it out! Thanks for sharing the fix.

  20. John
    Skrevet 2. august 2009 klokka 17:36 | Permalenke

    I am experiencing the ghost post problem described above as well – this fix sounds good, but where do I cut and paste the code?

    Currently the plugin reads:

    // Fool WP to believe it only has a given amount of posts, so that it doesn’t display a million posts on the front page
    $wp_query->post_count=get_option(‘posts_per_page’);

    Do I replace this with the code provided by bitkahuna? Do I add to it? I tried a few things but keep getting fatal errors in WP.

    2nd question – pluging lists “view all replies” and “reply to this” link below the post. Handy, but I would like the reply to this link to actually lead to a reply on that LAST comment. Right now, it just creates a top-level comment but that’s already offered by the “reply to” link in P2. Is there a simple fix?

    Thanks in advance.

  21. Skrevet 2. august 2009 klokka 18:48 | Permalenke

    yes john, just replace the original $wp_query line you posted with my few lines.

  22. John
    Skrevet 2. august 2009 klokka 19:03 | Permalenke

    Works like a champ, thanks for your reply.

    Any thoughts on how I could replace the “reply to this” link with a link that would let me reply to the LAST comment instead of to the top post?

  23. Skrevet 3. august 2009 klokka 0:40 | Permalenke

    Here is some useful information about threaded comments. You could probably use it to alter the plugin to be compatible with threaded comments.

  24. bonsak
    Skrevet 6. september 2010 klokka 8:20 | Permalenke

    I’m not shure why, but Sort by comments stopped working when i upgraded to wp 3.0.1 I know that SbC is only campatible up to 2.3.3, but it has worked for me all the way up to 2.9. Any chance of an update?

    Best regards
    Bonsak

  25. Skrevet 13. september 2010 klokka 15:41 | Permalenke

    Unfortunately, I will probably not find the time to do unpaid development work until december :( However, if someone comes up with a fix, I will of course happily include it in an update.

  26. Alberto
    Skrevet 31. desember 2011 klokka 19:32 | Permalenke

    Hi!!
    I want my response forum thread are sorted by date with the most recent first.
    I installed and activated the pluggin but I don´t know why no run
    Thanks!!

  27. Skrevet 1. januar 2012 klokka 14:32 | Permalenke

    This plugin hasn’t been updated in a while, and will probably break under recent versions of WordPress. It is no longer supported.

6 tilbakesporinger

  1. Av Lag forum av WordPress, skrevet 26. februar 2008 kl 9:50

    [...] jeg sjølsagt knote litt, og jeg har skrevet en plugin som legger til litt ekstra funksjonalitet. Sort by Comments sørger for at den sist kommenterte posten hopper til toppen, viser den siste kommentaren sammen [...]

  2. [...] Release Page | Download [...]

  3. Av Sobre WP » Ordena tus posts por comentarios, skrevet 4. mars 2008 kl 16:56

    [...] y descarga | Bare Thomas Marzo 4th, [...]

  4. Av Nuovi Plugins per Wordpress 1, skrevet 5. mars 2008 kl 11:58

    [...] Release Page | Download [...]

  5. Av WordPress Plugin Releases for 2/28 | OPOWAE, skrevet 6. mars 2008 kl 3:25

    [...] Release Page | Download [...]

  6. Av Misund: Bare Thomas » Lag forum av WordPress, skrevet 27. juli 2008 kl 4:08

    [...] jeg sjølsagt knote litt, og jeg har skrevet en plugin som legger til litt ekstra funksjonalitet. Sort by Comments sørger for at den sist kommenterte posten hopper til toppen, viser den siste kommentaren sammen [...]

Skriv en kommentar

Din e-postadresse deles eller publiseres aldri. Obligatoriske felt er merket med *

*
*

Du kan bruke følgende HTML-tagger og attributter: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blogglisten | Bloggurat

Twitter | 466 81 747 | thomas @ hemmeligadresse.com