WordPress Paged Comments Plugin

It is unlikely that I will be developing this plugin any further. WordPress has had paged comments support in the core since version 2.7. This site is now running version 2.8.2 and the comment paging you see here is using WordPress’s built-in code and not my plugin. I haven’t studied the code being used by WordPress so if there’s something I had in my plugin that’s missing from WordPress’ standard comment paging, let me know and I’ll see what I can do.

Paged Comments is a plugin for WordPress to allow comment paging. Useful for those popular blog entries receiving many comments, or a simple guestbook page within WordPress.

Features

  • Comment ordering: show latest comments first, or last
  • Specify number of comments to display per page
  • Enable paging for all posts and pages, or on a per-post basis
  • Give users the choice to view all comments on one page with a ’show all’ link
  • Specify the first or last page of comments to load by default
  • See paged-comments-config-sample.php for more

Download — Latest Version

Installation (for Wordpress 2.3 up to 2.7)

If you’re upgrading from a previous version, skip these installation steps and read the upgrade steps. Note: WordPress’ automatic upgrade feature will erase the plugin’s config file. If you’re going to use it, make sure you backup your paged-comments-config.php file first.

  1. Download and extract plugin files to a folder locally.
  2. Read through and edit paged-comments-config-sample.php to configure, then save the file as paged-comments-config.php.
  3. Upload the whole paged-comments directory to /wp-content/plugins/. The plugin files should now be in /wp-content/plugins/paged-comments/.
  4. Enable the plugin through the WordPress admin interface. That’s it!

Optional Steps

  • WP 2.7 users: If use_wp_config is set to true (default), you can make changes to the plugin config using the WP admin interface. Go to Settings > Discussion and look under ‘Other comment settings’.
  • To customise the template to work better with your theme: Open the plugin’s themes folder and find the subfolder corresponding to the WordPress theme you’d like paged comments enabled on (or if your theme isn’t listed, choose the ‘default’ folder). Upload comments-paged.php to the appropriate WordPress theme folder (found in [wordpress]/wp-content/themes/).

    For example, if you’re using the default WordPress theme, copy [paged-comments-plugin]/themes/default/comments-paged.php to [wordpress]/wp-content/themes/default/. (The plugin always tries to load comments-paged.php from your active theme folder first.)

    Make any modifications to comments-paged.php. The file is based on the comments.php file, so if your theme is very different it might be easier to copy in the necessary elements from paged-comments.php. View the diff report to see what you need to change.

Examples of Use

The comments on this page are handled by the plugin, but it’s also used by the following sites:

Questions?

Donate

If you find this piece of code useful, please consider donating. I’m a student working on these projects in my spare time. My sites carry no advertising and I release most of the code I work on under a free software license so anyone can benefit from it. I don’t receive any payment for this work so I have to rely on donations if I want to put off becoming a wage slave. Your contribution (whatever the amount) would be greatly appreciated.

Paid Support

If you run a commercial site and you’re having difficulty setting up paged comments, I offer paid support. Feel free to get in touch: keyvan (at) k1m.com

540 Comments

  1. Posted 4 February 2007 at 10:24 am | Permalink

    Keyvan:
    I just updated my Plugin with your new code. There are only a few (two or three) strings in your package. Why don’t you just use my code?

  2. Posted 7 February 2007 at 7:43 pm | Permalink

    patung: Glad to hear it’s working.

    kretzschmar: Thanks, I’ll include it in the next release.

  3. Posted 8 February 2007 at 6:46 am | Permalink

    Keyvan: I made one last change to the load_plugin_textdomain function. Now the path isn’t hardcoded anymore, so no problems if someone changes the directory name.
    Download it on my site.

    http://diekretzschmars.de/2007/paged-comments-deutsch/

  4. Posted 9 February 2007 at 11:02 pm | Permalink

    Well i tried it with wp 2.1, at first it did not work, so I tinkered a bit and manually renamed the template tag. Also for some reason it wouldent read the config file, so i added the config in the actual plugin.

    It works-ish, for some reason, no matter how I config, it only shows 5 comments in accending order per page.

  5. Posted 9 February 2007 at 11:26 pm | Permalink

    I meant 4. To bugtest I just echo’d out the $comment DB query which shows as:

    SELECT * FROM wp_comments WHERE comment_post_ID = '29' AND comment_approved = '1' ORDER BY comment_date DESC LIMIT 0, 4

    I don’t know why $limit_clause is returning 4…

  6. Posted 9 February 2007 at 11:38 pm | Permalink

    Ahh, I just changed the config from desc to asc ($paged_comments->ordering = 'ASC';) and it worked. I know what the problem was, it was because in the DESC mode the first page was the last page and it dident show the full 10 entries. Confusing but its ok.

  7. tracy
    Posted 10 February 2007 at 4:49 am | Permalink

    I am trying to get your plugin to work for on my guestbook page. I have 106 comments there.

    I have activated the plugin, I have the 3 files where they need to be…
    Here are my settings in the config file
    $paged_comments->all_posts = true;
    $paged_comments->all_pages = true;
    $paged_comments->per_page = 10;
    $paged_comments->ordering = ‘DESC’;
    $paged_comments->fill_last_page = true;
    $paged_comments->page_range = 11;
    $paged_comments->fancy_url = false;
    $paged_comments->show_all_option = true;
    $paged_comments->show_all_ordering = ‘ASC’;
    $paged_comments->default_page = ‘last’;
    I also have a custome field made on that page key, paged-comments value, on.

    WHat the heck do I have wrong?
    Thanks for your help

  8. Posted 11 February 2007 at 1:44 pm | Permalink

    Perfect, it functioned perfectly, I liked very, was organized the site after this plugin, congratulations! It confers as it was http://hunterxhunter.com.br/2007/?page_id=348

  9. rawk
    Posted 21 February 2007 at 1:52 am | Permalink

    Dear Keyvan,

    I installed your great plugin and it works beautifully. However, there is an incompatibility with the Gengo plugin (http://jamietalbot.com/wp-hacks/gengo/) which allows Wordpress to handle multiple language versions of the same post.

    The incompatibility arises when turning on $paged_comments->fancy_url. It seems to be an issue with ordering of plugin loading, in fact gengo appends a language code to the fancy url, eg. server.com/mypost/en/ and when enabling fancy urls to your plugin, i get something like server.com/mypost/en/comments/en/ which gives page not found.

    Is this fixable within your plugin, or should it be fixed in gengo?

    Thank you for your kind attention
    All the best,

  10. Posted 23 February 2007 at 12:33 am | Permalink

    Thanks for the comments everyone, I’ll get to them all in the next few days.

  11. toph
    Posted 24 February 2007 at 4:07 pm | Permalink

    Does this work with the AJAX comments plugin?

  12. tres
    Posted 1 March 2007 at 1:20 am | Permalink

    i never got this to work properly, maybe because of my poor php skills. anyways.

    is there any way an install/uninstall of this plugin could disable comments on pages completely? i deactivated and rid of everything to re-install and now pages can’t be commented at all …

  13. Posted 9 March 2007 at 7:53 am | Permalink

    Hey I noticed your paged comments links are nice and clean. They appear as “comment-page-#” but mine appear as the id page number links. What change do i need to make to fix this?

  14. Posted 9 March 2007 at 12:30 pm | Permalink

    A new release will be coming soon. I’ve just had a fix submitted for those of you experiencing the eval error. Edit paged-comments.php and replace the last few lines of instructions with these:

    
    if (strpos($file_contents, 'paged_comments_template()') === false) {
      set_include_path(TEMPLATEPATH);
      $file_contents = str_replace('comments_template()', 'paged_comments_template()', $file_contents);
      $file_contents = str_replace(''.trim($file_contents));
      restore_include_path();
      exit;
    }
    

    Thanks to Alexey G for the fix.

  15. Posted 9 March 2007 at 12:34 pm | Permalink

    sahas: Enable the fancy_url option to get the comment-page-xx style links.

  16. Posted 19 March 2007 at 11:43 am | Permalink

    i’m always getting errors whenever i install this… :(

    i’m using wordpress version 2.1.2
    i’m also using permalinks…
    i also edited the fancy url part of the paged-comments-config.php and set it to true..
    if you go to a post, you’ll see that it’s working. you’ll see the comments and the number of pages the comments were divided to .
    but how come whenever i decide to go to another page of comments {ex. the 3rd page}, a ‘Cannot Find Server’ or ‘Not Found’ page comes out?

  17. Jason B
    Posted 29 March 2007 at 3:50 pm | Permalink

    I must be using your plugin wrong because I cant seem to get it to work on my site. I downloaded the files, renamed the sample file. Uploaded to the plugins folder. Uploaded to theme folder, activated plugin and nothing.

    Any ideas?

  18. Dan
    Posted 7 April 2007 at 10:28 am | Permalink

    Great plugin Keyvan, but do you know how to enable paged comments for popup comments. There’s a small mention about it a while back, but no follow up. I guess it’s not a very popular feature, but I’d really like to get this feature on my blog, and would gladly put in a donation if you could help me out.

    Thanks.

  19. Posted 11 April 2007 at 6:20 pm | Permalink

    Keyvan … this sounds like a great plugin that would really help me out, but when I tried to activate it, my site totally disappeared. My homepage and everything else had absolutely no content. Couldn’t even access WP admin.

    Any idea what I did wrong?

    I’m using WP 2.1 … that should be OK, right?

    Here’s my site:
    http://www.boyslife.org/section/games/games-guru/

  20. Posted 28 April 2007 at 7:53 pm | Permalink

    Keyvan,
    Thank you for a great plugin, I’ve been using it for over a year now. Some of my posts have a few hundreds comments and your plugin really helps.

  21. Posted 4 May 2007 at 4:48 pm | Permalink

    Thanks for the comments everyone. To those having problems, please try version 2.6. The directory structure has changed, so if you’re currently using 2.5, read the upgrade steps.

    New features/fixes

    * German users should see ‘Show All’, ‘Newer Comments’ and ‘Older Comments’ translated. Thanks kretzschmar.

    * Eval problem should be gone now. Thanks AlexeyG.

    * Install for first-time users is now easier. No more copying template files to the theme folder.

    Please let me know if you experience any problems.

  22. Bryan
    Posted 7 May 2007 at 8:16 pm | Permalink

    Hey Keyvan … I downloaded the new plugin, but still no luck activating it. I get a blank site and blank admin page, and my site only comes back if I delete the plugin.

    I’m sure it’s my fault. Probably a problem with my WP install, which is too bad because I could really use your plugin. I have a post with 800 comments that REALLY needs to be paged.

    Thanks.

  23. Posted 9 May 2007 at 12:36 am | Permalink

    thank you for providing this plugin to the people.

  24. Anonymous
    Posted 11 May 2007 at 5:48 am | Permalink

    […] テーマを変更するにあたって、入れたのすっかり忘れてたのがコレ。 GuestBook自体はPluginではなくテンプレートですね。でもって、GuestBookにするとコメントが多くなるので Plugin:Paged Comments を利用しております。配布元:WordPress Paged Comments Plugin […]

  25. Alec
    Posted 24 May 2007 at 1:07 am | Permalink

    Hi,

    Why is that when I run
    if ($paged_comments->pager->num_pages() > 1)

    It gives:
    Fatal error: Call to a member function on a non-object in comments.php on line 21

  26. Posted 26 May 2007 at 6:18 pm | Permalink

    I’ve installed your great plugin! but I’ve a problem with language… How can I set italian language?

    (example “show all” = “Mostra tutti”, “Responses to” = “commenti lasciati su”)

    thanks in advance

  27. Posted 29 May 2007 at 11:52 am | Permalink

    Although i don’t have many comments on my blog, i do appreciate this plugin very much. Thanks for sharing.

  28. Posted 30 May 2007 at 4:34 am | Permalink

    I’m having somewhat of a usability problem when a user leaves a comment, but is taken to the first page rather than the page their comment is actual posted. Any ideas?

  29. Sergio
    Posted 1 June 2007 at 2:16 pm | Permalink

    I have installed your plugin to paginate my guestbook (made with Guestbook Generator plugin http://wordpress.org/extend/plugins/guestbook-generator/) , but it doesen’t works.
    It works in all the pages of my blog, except the guestobook page…
    Can you help me? Tanks, and sorry for my bad english…

  30. Posted 2 June 2007 at 1:54 pm | Permalink

    sdamy: I don’t have translations for the Italian language. If you (or anyone else) is able to translate and send me the strings used by the plugin, please let me know. You can see the 3 strings used by the plugin here: paged-comments.pot.

    Ronald: Redirecting users to the comment page containing their submitted comment is something I’m going to look at for the next release.

    Sergio: I’m not familiar with that plugin, but I don’t think you need a plugin to create a guestbook page for you. Simply creating a Wordpress page and calling it ‘Guestbook’ should work fine.

  31. Posted 4 June 2007 at 4:01 am | Permalink

    This plugin is GREAT!!

  32. Annelie
    Posted 5 June 2007 at 12:18 pm | Permalink

    Hello!
    Yesterday I installed your Paged Comments Plug-in to my guestbook’s page in WP 2.2.

    I have tried to configure the config-file, but nothing happens. My earliest post shows first and I can’t see any page numbers. (I want to read the latest comments first.)

    I don’t know if I had set the wrong code in my guestbook
    to called the template.

    I have tried to have the comment-paged.php, but when I do that I got this message.

    Fatal error: Call to a member function on a non-object in /home/u/utmattningsdepressionnet/…/themes/refresh/comments-paged.php on line 26

    Please, can you give me a tip how to fix this problem?

    I hope you can understand what I mean; my English is not the best.

  33. Annelie
    Posted 5 June 2007 at 1:01 pm | Permalink

    Sorry, I was too quick to post my earlier comment! I missed to read all text in your paged-comments.php file. Now I have change my guestbook to and it works great! Thank you for a great plug-in!

  34. Posted 6 June 2007 at 7:34 am | Permalink

    HI! I am looking forward to making this work.

    Right now I get an error

    Fatal error: Call to a member function on a non-object in /home/sinocida/public_html/dev/wp-content/themes/tiga-06/comments.php on line 105

    My line 105 of comments.php is:

    ??? Any idea?

  35. Posted 6 June 2007 at 7:34 am | Permalink

    HI! I am looking forward to making this work.

    Right now I get an error

    Fatal error: Call to a member function on a non-object in /home/sinocida/public_html/dev/wp-content/themes/tiga-06/comments.php on line 105

    My line 105 of comments.php is:

    ??? Any idea?

    Using 2.0

  36. Posted 6 June 2007 at 7:45 am | Permalink

    Sorry, meant to say 2.1 latest update…

  37. Posted 8 June 2007 at 8:16 am | Permalink

    Hi.

    I tried again today, and it works with Classic Theme, but not with Tiga-06. Is anyone using the Tiga-06 theme, or can help me out?

    Thanks,

    LaoLao

  38. Posted 11 June 2007 at 4:22 am | Permalink

    Hi, I already using the latest Paged Comments already. But seem like it doesn’t proper at wordpress 2.2

  39. Posted 11 June 2007 at 4:28 pm | Permalink

    thanks for this plugin very nice

  40. Posted 21 June 2007 at 5:36 am | Permalink

    Great plugin Keyvan, but do you know how to enable paged comments for popup comments. There’s a small mention about it a while back, but no follow up. I guess it’s not a very popular feature, but I’d really like to get this feature on my blog, and would gladly put in a donation if you could help me out.

  41. Posted 24 June 2007 at 9:10 am | Permalink

    很好用……谢谢

  42. Nuetral
    Posted 26 June 2007 at 6:36 am | Permalink

    Really looking forward to your AJAX paged comments. The demo looks awesome!

    Any idea when it might be done?

  43. Posted 26 June 2007 at 6:38 am | Permalink

    Used this Paged Comments Plugin, the wp-print cann’t normal operation!Look at the trouble,Thank very much!

  44. Posted 29 June 2007 at 12:16 am | Permalink

    This is a great plugin, thanks! One problem I have is that it doesn’t honor my themes comment template. For instance, I’m using sandbox which has extremely semantic rich markup and I do all my styling using CSS. But a lot of that doesn’t work when I activate this plugin, because it generates its own markup for comments. What are your thoughts on this?

  45. Posted 29 June 2007 at 1:21 am | Permalink

    数据恢复: I’ve never used popup comments, but if I get time I’ll have a look and see if there’s anyway I can support popup comments.

    Nuetral: Version 3 should let you enable AJAX paging – I can’t give a release date though. It’s the most requested feature at the moment, but it’s also the feature that requires the most work.

    thin: The wp-print incompatibility has been mentioned before. I’ll try and look into it for the next version.

    Diwaker: I don’t know of an easy way to enable paging without altering the comments.php markup. By default, the plugin uses a modified comments.php file based on the one supplied with the default WP theme. You can see a side by side code comparison of the changes. If you open the comments.php file supplied in the sandbox theme you should be able to copy in the highlighted code and save the file as comments-paged.php in your sandbox theme folder. The plugin will look for this before attempting to load the bundled template (based on WP’s default theme). Hope that helps.

    If you do happen to create a version of the template for the sandbox theme, please let me know. I’d like to include one in the next release.

  46. Posted 29 June 2007 at 8:56 am | Permalink

    @Keyvan
    Thank you for your reply, I am looking forward to a version!
    :)

  47. Posted 5 July 2007 at 5:03 pm | Permalink

    Thank you so much!

    I had tried this plug-in before, but because the theme I’m using didn’t work straight away, I had given up.

    Had another look tonight and actually perused this site enough to be made to think about comparing the comments.php and comments-paged.php files together — EASY(ish)!

    Now, I don’t crash Firefox 2 on the Mac everytime I check my 250~ comment page :P

    Great work guys n girls!

  48. Posted 17 July 2007 at 10:37 am | Permalink

    Thanks for this! I will be using this pretty soon. By the way you have a really cool and clean site. Nice.

  49. Rob
    Posted 18 July 2007 at 8:25 am | Permalink

    HOW DO I REMOVE THE PAGE NUMBERING??? YOUR COMMENTS DONT SHOW THE PAGE NUMBERING PLEASE HELP!

  50. Posted 20 July 2007 at 5:17 am | Permalink

    Unfortunately, your great plugin breaks

    Paged Comments plugin
    http://www.keyvan.net/code/paged-comments/

    Info:
    http://forums.lesterchan.net/index.php/topic,566.20.html

    I’m hoping you might issue a fix so these two plugins become compatible.

279 Trackbacks

  1. [...] good way to keep your comments tidy when you have a tremendous long list of comments. Check it out there  and click Show All at the comment section. You will know what I mean. I have seen a lot of blogs, [...]

  2. [...] Eklenti Adı : WordPress Paged Comments Plugin İşlevi : Her 10 yorumda bir sayfalama yaparak sayfalarımızın uzayıp gitmesini engeller. Kaynak : WordPress Paged Comments Plugin [...]

  3. [...] Paged Comments by keyvan (to be used for guestbook). Use this output settings: [...]

  4. [...] WordPress Paged Comments Si tus visitantes son de los que les gusta comentar, este plugin te vendrá bien, porque te permite paginar los comentarios echos a cada entrada. [...]

  5. [...] 到目前为止, 我只试验过这个函数, 具体还未利用到。 不过 paged comments 就利用了这个函数解决了本要修改主题模板的麻烦, [...]

  6. [...] (click to see the screenshot) Yup, finally, it’s separated. It even support the famous Paged Comments, of course, with a little hacked. Please download the plugin from MangoOrange instead. I have sent [...]

  7. [...] needed if your comment number ever goes above ten, or in case you expect it to do that soon, is the Paged Comments Plugin. This automatically reverses the comments too, but you can undo that process, if you prefer. The [...]

  8. [...] Paged Comments 插件支持模板。这个插件可以将评论分页,对于评论比较多的名博尤其有用,Apple Theme 已经集成了该插件所需要的评论模板文件。 [...]

  9. [...] volver farragosos y largos de cargar si tienen muchos comentarios. Buscando por ahí encontré este plugin (paged-comments) que soluciona ese problema. La instalación es [...]

  10. [...] (1)KEYVANサイトさんよりVersion 2.6.4 (2007-07-31) (zip file) をダウンロードしました。 「paged-comments」ホルダに paged-comments-config-sample.phpファイル paged-comments.phpファイル languagesホルダ themesホルダ readme.txt の5点が格納されています。 [...]

  11. [...] Pagged comments es especialmente útil para blogs con muchos comentarios. [...]

  12. [...] Paged Comments [...]

  13. [...] un moment donné, ça suffit! J’ai ajouté un plugin de pagination des commentaires pour éviter que les pages avec plusieurs commentaires aient 3 km de long et prennent 10 minutes à [...]

  14. [...] (1)KEYVANサイトさんよりVersion 2.6.4 (2007-07-31) (zip file) をダウンロードしました。 「paged-comments」ホルダに paged-comments-config-sample.phpファイル paged-comments.phpファイル languagesホルダ themesホルダ readme.txt の5点が格納されています。 [...]

  15. [...] to achieve the contact form. This fantastic plugin is from Mike Cherim and Mike Jolley.I also use Paged Comments by Keyvan Minoukadeh to make comments paged. Thanks to you guys. You are so talented web [...]

  16. By Paged comments plugin update v2.8 | de ce? blog on 20 August 2008 at 6:44 pm

    [...] update v2.8 20 August 2008 19:40 Cel mai frumos scris si util plugin de paginare a comentarilor – Paged comments a lui Keyvan Minoukadeh – a primit un update pe care il asteptam de multa vreme: versiunea 2.8 rezolva problema (cu lipsa) [...]

  17. By Dealing with too many comments - SEO Horror on 23 August 2008 at 6:35 am

    [...] solution is the Wordpress paged comments plugin. This little plugin allows you to have paged comments on your blog instead of having a single page [...]

  18. By WordPress 2.7: Paged Comments im Template? on 23 October 2008 at 6:01 am

    [...] zur Theorie. Eines vorneweg – alteingesessene Plugins wie PagedComments, welches auch die Navigation im Screenshot rechts hier im Blog erstellt hat, kann diese Funktion [...]

  19. By Mic ghid de optimizare wordpress » zoso's blog on 31 October 2008 at 10:23 am

    [...] Paginarea comentariilor. Să afişezi 180 comentarii pe o singură pagină nu e doar un efort pentru browser, ci şi pentru sistemul pe care rulează blogul. De aceea e recomandat să le paginaţi, mai ales dacă aveţi mai mult de 50 comentarii per post. [...]

  20. By Custom Permalinks | Michael Tyson on 12 November 2008 at 6:19 am

    [...] you notice that some plugins, such as Keyvan Minoukadeh’s Paged Comments plugin, are not operating correctly, then ensure that your custom permalinks have a trailing slash [...]

  21. [...] Paged Comments (plugin) – Technically, not a performance plugin. However, paged comments will reduce page load time for articles which attract hundreds of comments. Example post with 382 comments. [...]

  22. By 10 Plugins to Test Drive WordPress 2.7 Right Now on 24 November 2008 at 4:22 pm

    [...] Paged Comments The Name says it all. It Breaks down comments into a number of pages. [...]

  23. [...] sure you’ve all been to a post which has hundreds of comments and it takes forever to load. Paginate your comments once there’s too many to load on a single [...]

  24. By »» Dont Touch Me «« » Comments Pagination on 25 December 2008 at 11:49 am

    [...] overload query ke database pada artikel yang memiliki banyak komentar. Aku memakai plugin Paged Comments 2.9.1 yang sebelumnya hanya aku pakai untuk page Guestbook. Yang bikin aku pusing, split antara komentar [...]

  25. [...] Il  sito ufficiale del progetto invece è questo: http://www.keyvan.net/code/paged-comments/ [...]

  26. [...] should work with most plugins. It has plug & play support for these: Subscribe to Comments, Paged Comments, LMB Box Comment Quicktags, WP-PageNavi, WP-Email, WP-Print, WP-PostViews and Sociable. Tested with [...]

  27. By Pagination for comments in Wordpress | iMod on 18 June 2009 at 2:26 pm

    [...] Wordpress Paged Comments is a plugin for WordPress to allow comment paging. [...]

  28. [...] meses que busco información sobre cómo cambiar el title a las páginas de los comentarios (uso el plugin Paged Comments); finalmente lo conseguí: sólo se trata de meter en una condición en el header que si estás en [...]

  29. [...] keempat, Paged Comments. Ini juga salah satu plugin yang sudah saya gunakan sejak lama, dibuat oleh keyvan. Fungsinya [...]