Keyvan Minoukadeh

WordPress Paged Comments Plugin

Filed under: General — Keyvan @ 12:24 am

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

Download — Latest Version

Related Downloads

Installation for WordPress 1.5 and 2.x

If you’re upgrading from a previous version, skip these installation steps and read the upgrade steps.

  1. Download and extract plugin files to a folder locally.
  2. 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 for WordPress 2 users!
  5. WordPress 1.5 users: If you enabled the fancy_url feature in step 2, edit your .htaccess file and enter these lines:

    RewriteRule ^(.+/)comment-page-([0-9]+)/?$ $1?cp=$2 [QSA,L]
    RewriteRule ^(.+/)all-comments/?$ $1?cp=all [QSA,L]

    at the end of the file beneath the ‘#END WordPress’ marker (this ensures WordPress leaves the rule alone when updating the other rewrite rules).

Optional Steps

  • 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

Questions?

Donate

I work on this plugin in my spare time. If you find it useful, please consider donating to help me continue work on the plugin. (This plugin is, and will remain, freely available and open source, please only donate if you want to and can afford it.)

This month I’ve received £0 ($0/€0) :(

680 Responses to “WordPress Paged Comments Plugin”

  • 1
    ChrisBunting.com » Blog Archive » Major site additions

    [...] and normally not visible, even through the admin interface. I’ve also installed the Paged Comments plugin by Keyvan Minoukadeh. This plugin is different from the above p [...]

  • 2
    geeksmakemehot.com » GuestBook Comments

    [...] very day, I decided my Guestbook was getting a little lengthy. I found a great new plugin Paged Comments. WordPress Paged Comments is a plugin for WordPress 1.5 to allow comment paging. Usef [...]

  • 3
    Blooming Town » Plugin: Paged-Comments

    [...] 페이지로 나뉘어지는 플러그인 부러워하다가 결국 달았다. - 참고: WordPress Paged Comments Plugin -설치 * 플러그인 다운로드받기: redal [...]

  • 4
    kristin

    Excellant plugin! I have a post that has over 500 comments and is such a pain on my server when it loads. This plugin has helped me out so much :)

  • 5
    Chris Waigl

    Great plugin, thanks a lot for your work!

  • 6
    culdesac

    thanx!

  • 7
    Ampersand

    I’m afraid I’m pretty computer-illiterate. I installed this plug-in, and it’s working great; except that where I used to have numbered comments, since I installed this plug-in there’s a bullet and then a number. Also, the bullet and number now appear above the comment, rather than to the side of the comment as on a normal html ordered list.

    If you could suggest what I could do to use your plug-in, but also to get rid of the bullet and put the number back on the same level as the start of the comment, I’d appreciate it. Thanks!

  • 8
    Steph

    I’m a little lost here…I’m using wp 1.5.1.3 and I’m looking in the comments template for my theme…but I can’t figure out where I’m supposed to replace the code. I didn’t find anything like “comments_template()” in the file…where am I supposed to make the change? :\

    Also, how would I use this as a guestbook?

    Thanks.

  • 9
    Keyvan

    Hi Steph,

    You shouldn’t be editing the comments template itself, simply pointing to the alternative comments template (wp-paged-comments.php) provided with the plugin.

    You should have a folder called themes within the wp-content folder of your WordPress (WP) installation. Inside you’ll see further folders with names corresponding to the themes available to your WP site. Find the theme currently active on your site and inside the folder you’ll find the template files you’ll need to edit. These differ from theme to theme, some themes include single.php or page.php template files which you should edit, but if you can’t see these you should open all the PHP files within your theme folder and search for the comments_template() method call. Replace every instance of the method call as described in step 5 of the installation instructions.

    The alternative comments template you’ll be pointing to (wp-paged-comments.php) is based on comments.php from WP’s default theme. This shouldn’t be a problem as it only contains minimal HTML, but if the theme you’re using is heavily customised you might want to edit this file to resemble your theme’s own comments template.

    Creating a guestbook page is simply a matter of creating a WP page like any other (but with comments enabled) and designating it the guestbook within your site. You don’t even need this plugin if you’re happy having all your guestbook entries (ie. comments associated with your ‘guestbook’ page) appearing on a single page.
    If, however, your guestbook grows to hundreds or thousands of entries, you may not want to deluge visitors with everything on one page (bandwidth costs may also be a concern here), instead you have the option of enabling this plugin and serving up comments in smaller chunks.

    Hope that helps. Let me know how you get along.

  • 10
    Steph

    I found the call in the main template page, but yeah I’m not using the default theme, I’m using a customized version of Rin. The comments template looks to be quite modified from the default template, I think it would be too confusing and too much work for me to get it to match (afraid I’d FUBAR the whole thing). >_

  • 11
    stephen

    I inserted the code, but all I see is my comments being numbered above the comment. I’m not seeing the numbers at the bottom and so on. I have not modified the code of the template at all- fresh out of the box. And when I get the plugin working, how do I set a limit on how many comments I want on a page? Do I have to modify the wp-paged comments.php? I’m using the falling leaves template, and I replaced the comment_template() code in the index.php page and the single.php page.

    Thanks for the help

  • 12
    Tinyblob.net » Credits & resources

    [...] . I’m currently using the following plug-ins… Front Page Cats Gravatars Paged Comments Post Templates by Category Post Updated RunPHP wpContactForm WP-Grins wpPaginate [...]

  • 13
    Anonymous

    Nice work chief ;-)

  • 14
    # kukie » 쪽page 기능으로 방명록guestbook 만들기

    [...] 순서도 결정하고, commeents가 많은 경우 페이지 처리 하고 싶은 경우 WordPress Paged Comments Plugin을 다운로드 받는다. 이렇게 했지비~
    Entry Filed unde [...]

  • 15
    Frank

    very nice plugin for wordpress!
    i have translate your wp-paged-comments.php in german, for default german theme.

    Link: http://www.bueltge.de/wp-content/download/wp/wp-paged-comments.php.txt

    With best regards!

  • 16
    HYPERGURU

    Hi,
    beautiful plug-in but would it be possible to have comments only in the first paged one, the one with the article body and NO article body text in the following pages?

    example:
    http://www.example.org/2005/08/12/my-article/
    includes the article plus the first 10 comments
    while
    http://www.example.org/2005/08/12/my-article/comments/2
    includes ONLY the following 10 comments with NO article and possible a link the the former page.

    Many thanks.
    Massimo.

  • 17
    Keyvan

    Ampersand and Stephen:
    To alter the style of the comments you’ll have to fiddle with the CSS.

    Here’s the CSS snippet for comments I use on my own site:

    #commentlist {
        clear: both;
        margin: 0;
        padding: 0;
    }
    #commentlist li {
        background-color: #F5F5F5;
        border-bottom: 1px solid #ccc;
        border-right: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 5px 3px 1px 10px;
        list-style-type: none;
        -moz-border-radius: 15px;
        font-size: .9em;
    }
    #commentlist li.alt {
        background-color: #ECECEC;
        border-bottom: 1px solid #aaa;
        border-right: 1px solid #aaa;
    }
    div.comment-number {
        position: absolute;
        right: 1.7em;
        text-align: right;
        font-size: 1.7em;
        font-weight: bold;
        font-family: arial;
        padding: .15em;
        color: #aaa;
    }

    You’ll probably have to alter this to suit your own site, but I hope you find it helpful. The last CSS rule on div.comment-number specifies where the comment number will appear.

    To set a limit on the number of comments appearing on each page you’ll have to modify the paged-comments.php file and alter the line with the per_page value: $paged_comments->per_page = 10;

    Frank:
    Thank you! I’ve added a link on this page to your translated German version.

    Massimo:
    A very simple solution can be found here. The last solution on that page is implemented on the site.

  • 18
    stilgar

    Thanks, very useful. I modified it a little to display the last comments at the bottom of the page, but still sorting the pages from last to first.

  • 19
    Martin

    Hi
    Somethings really wierd here… or? i’m creating a static page with comments enabled but it doesnt show any commentfields or textboxes at all…? I have Random_Image as theme.

    am i wrong? shouldnt i just write/create a page and allow comments?

  • 20
    Keyvan

    The page template within the default WordPress theme (and probabaly other themes) doesn’t include the code required for comments to be left and viewed. WordPress is, however, capable of linking comments to pages in addition to regular posts. Look in the theme folder and you’ll probabaly find a page.php file (the template for WordPress pages). If you edit this file and copy over the line(s) of code that calls comments_template() you’ll find comments will work within pages too.

    Some themes (for example, K2) include a page template and a “page with comments” template. This gives you the option of selecting the appropriate template within WordPress when creating a new page.

  • 21
    Martin

    You wrote:
    “Some themes (for example, K2) include a page template and a “page with comments” template. This gives you the option of selecting the appropriate template within WordPress when creating a new page.”

    In my template i dont have that option. I still havent figured this out. I can see my wp-paged-comments.php in the theme editor but when i create a new page i have only the link and archive page but in in the “Custom Fields” where i can “Add a new custom field to this post” there i can see the wp-page-template. but i cant do anything with it.

    I have set the Comments per page to 5 and the Page range to 5 and i have 11 comments in my “guestbook”. but it doesnt show any comments per page. i thought it worked but it didnt.

    I have copy over the “comments_template()” with ”
    ” and i did it on the the single.php.

    thanks

  • 22
    Threaded Comment + Paged Comment at . 0 8 2 N e T .

    [...] 옮겨오면서 방명록을 하나 만들어보려고 사방 팔방을 돌아다니던중… 두가지 플러그 인을 발견하고 이제 됬구만~ 안심을 했는데…전혀?? 없으니.. 혼자 해결할 능력이 안되는 저로서 막막하기만 하다는… ;( 초보적인 생각으로 고민해본 결과는… paged 플러그인이 thread된갯수는 무시하고 메인(母)이 되는 코멘트의 갯수만 인식하게 할 수 있다면… 그러니까 메인이 되는 코멘트 갯수만 5개이고 그 5개의 코멘트에해도.. 그냥 한 페이지에 표시되게만 할 수 있다면, 문제는 해결 되는것… 물론.. 생각만으로 끝… 더 이상 생각을 발전시키거나 실행에불가능… ㅎㅎㅎㅎㅎ P.S. 혹시라도 힌트가 될만한 사항이 있으시면 찔러주세요~~;)   #     [...]

  • 23
    Sandro

    Hi, Thank you very much for the great work.

    One Question is left: at my site the counting is some kind of weird. For example when i have 11 commments on the post, there is only the 11th displayd. But it should show 10 on the “Page 2″ and only 1 on page “1″.

    Because now, the one who posts the 11th comment ist the one and ondly visible comment without clicking further.

    Can i solve that somwhere in the config?
    Regards Sandro

  • 24
    gt.grf » Blog Archive » gt.Candy

    [...] Paged Comments plugin을 guestbook에 사용 [...]

  • 25
    Keyvan

    Martin, I’m not quite sure where you’re going wrong. You can ignore my comment about themes providing a comment-enabled template for the time being (that doesn’t affect the installation procedure nor the plugin’s operation). If you’re prepared to start again, I’d recommend you download the latest version of the plugin (version 2) and follow the updated installation instructions. If you’re still having problems, or if you feel my installation steps are too vague, please post again with more information and I’ll do my best to help.

  • 26
    Keyvan

    Sandro, the behaviour you describe is the result of a conscious decision to “fix” each comment to its associated comment page. It is deliberately implemented this way to prevent comments from shifting from page to page when new ones get added. (It also ensures comments appear on the same comment page regardless of page order.) One issue that would arise if the plugin behaved in the way you describe is that of invalid comment permalinks. Some people like to have permalinks to comments, but if a comment can shift from page 2 to page 1, it makes it difficult to pin the comment down to one URL. Even the current implementation leaves a lot to be desired. (For example, comments deleted from the admin interface will cause shifts.)

    Having said that, I realise many people aren’t too fussed about the permalinks issue, and would rather see the latest 10 or so comments when viewing an entry. So I will try and add an option for enabling the behaviour you describe. I’ll let you know when it’s done.

  • 27
    8 Seconden » Paged Comments

    [...] Heb je een blog waar bij sommige posts het aantal reacties enorm oploopt? Dan is de Paged Comments plugin de oplossing. Deze plugin zorgt ervoor dat de reacties netjes verdeeld worden over verschillende pagina’s, zodat niet alleen de pagina sneller laadt, maar ook je bandbreedte kosten beperkt blijven. [...]

  • 28
    Vincent

    Thank you!

  • 29
    Random Curiosity » Random Musings: Site and Series Updates

    [...] moyism informed me of WordPress plugin that allows you to have paged comments. I installed it and fiddled around with it until it looked similar to the old style. So comments are now shown 20 to a page. I actually wouldn’t have considered using this plugin if last week’s GSD final episode post hadn’t gone over 100 comments. Anyway, if you experience any types of problems, leave a comment or send me an email. [...]

  • 30
    Blogging according to Ajay » Guestbook in WordPress 1.5

    [...] Don’t know if I would ever put a Guestbook on my blog, but I’m seriously considering using the WordPress Paged Comments Plugin, since many page already have a lot of comments. [...]

  • 31
    wonny

    Hey,

    I’m trying to use your plugin with Brian’s Threaded Comments. It seems that I will need to edit paged-comments.php. Can you tell me how I can do this? I have very little knowledge in these kind of things.

  • 32
    Trustin Lee

    Hi Keyvan, I’ve merged your paged comments plugin and Brian’s threaded comments plugin here: http://gleamynode.net/wordpress/archives/106

    I hope this can help ppl who encountered the same issue.

  • 33
    gio

    Hi Keyvan, thanks for the great plugin. I’m using a WP theme known as Pool ( http://www.lamateporunyogur.net/pool ). I’ve installed and activated the latest version of your plugin. I’ve edited the necessary phps, replacing the call function just as in point 4 and 5 above. I’ve not edited the CSS. Please click here http://img97.imageshack.us/img97/3892/poolpcproblems9mo.jpg to see what my problems are. I’ll sum up my problems in words as well:

    1) the comment entry box is way off.
    2) the posted comments have lost the original format of the Pool Theme. Original theme has alternating grey/darkgrey box.
    3) The comment post number position: i wish to have it at the top right corner of the posted comment box.
    4) i wish to retain the original theme elabarotion on some XHTML instructions below the comment entry box.

    I’ve tested it on both Firefox 1.0.7 and IE 6.0, and both gave the same result.

    Since i’ve not touch the theme’s CSS, i’ve cut and pasted the Comments components of the CSS for you to examine:

    #commentlist {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }
    #commentlist li {
        margin: 10px 0;
        padding: 5px 10px;
    }
    #commentlist p {
        margin: 0;
        padding: 0;
    }
    #commentlist small {
        font-size: 11px;
    }
    .class_comment1 {
        background: #E9E9EA;
        border: 1px solid #E0DEDE;
    }
    .class_comment2 {
        background: #F4F3F3;
        border: 1px solid #E0DEDE;
    }
    #comments, #postcomment {
        color: #0090DA;
        font-size: 14px !important;
        font-weight: normal;
        margin: 40px 0 10px 10px;
        text-transform: uppercase;
    }
    #commentform {
        background: #D3E4FF;
        border: 1px solid #D8D8D8;
        padding: 5px 20px;
    }
    #commentform input,
    #commentform textarea {
        background: #F9FBFF;
        border: 1px solid #B8D4FF;
        font-size: 12px;
        padding: 1px;
    }
    #commentform input:focus,
    #commentform textarea:focus {
        background: #EEF5FF;
    }
    div.comment-number {
        float: right;
        color: #999;
        width: 40px;
        text-align: right;
    }

    If only you can download the Pool theme and try to edit it such that your plugin will work perfectly with it, that will be really great! If otherwise, i would still appreciate if you can edit the css as you see above, such that all my problems could be rectified… Thanks for your time and effort! I hope to hear from you soon. Cheers.

  • 34
    Keyvan

    Hi Gio, I’ll try and create a paged comments template for that theme (it appears to be a popular one). Hopefully tomorrow, but could be later.

  • 35
    Keyvan

    Gio, the comments-paged.php for the Pool theme is available here: http://dev.wp-plugins.org/browser/paged-comments/trunk/themes/pool/. You’ll need to add the additional CSS (found in the readme.txt file) to your style.css if you want to display the comment numbers on the top right corner. You can see it working here: http://www.keyvan.net/wordpress-testbed/?p=3#comments

  • 36
    gio

    Dear Keyvan, thanks for the great support and implementation! Everything works smoothly, it’s clean as a whistle. I’ll be spreading the word to all Pool theme users. Cheers mate!

  • 37
    Gio

    Sorry Keyvan, another problem. I’ve implemented the fancy url to “true”. But the new permalinks for the comments don;t work. I will get redirected to my home page, with a “Not Found, Error 404″. I have permalink on at my site, and it works perfectly. I’ve only had problems with your fancy url not working. I’ve added the 2 lines after “#end wordpress” in .htaccess. This is how my .htaccess looks like now:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://giolovesgod.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://giolovesgod.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.giolovesgod.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.giolovesgod.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://images.google.com*/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://images.google.com*$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ http://img415.imageshack.us/img415/925/nohotlinking1sq.gif [R,NC]
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [S=59]
    RewriteRule ^(guestbook)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(guestbook)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(guestbook)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(guestbook)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(guestbook)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^(about)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(about)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(about)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(about)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(about)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^(gallery)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(gallery)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(gallery)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(gallery)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(gallery)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^(links)/trackback/?$ /index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(links)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(links)/(feed|rdf|rss|rss2|atom)/?$ /index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(links)/page/?([0-9]{1,})/?$ /index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(links)(/[0-9]+)?/?$ /index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /index.php?s=$1 [QSA,L]
    RewriteRule ^category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^category/(.+)/?$ /index.php?category_name=$1 [QSA,L]
    RewriteRule ^author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/page/?([0-9]{1,})/?$ /index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/?$ /index.php?author_name=$1 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/page/?([0-9]{1,})/?$ /index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/?$ /index.php?year=$1 [QSA,L]
    RewriteRule ^(.+)/([^/]+)/trackback/?$ /index.php?category_name=$1&name=$2&tb=1 [QSA,L]
    RewriteRule ^(.+)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&name=$2&feed=$3 [QSA,L]
    RewriteRule ^(.+)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&name=$2&feed=$3 [QSA,L]
    RewriteRule ^(.+)/([^/]+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&name=$2&paged=$3 [QSA,L]
    RewriteRule ^(.+)/([^/]+)(/[0-9]+)?/?$ /index.php?category_name=$1&name=$2&page=$3 [QSA,L]
    RewriteRule ^(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^(.+)/?$ /index.php?category_name=$1 [QSA,L]
    # END WordPress
    RewriteRule ^(.+/)comment-page-([0-9]+)/?$ $1?cp=$2 [QSA,L]
    RewriteRule ^(.+/)all-comments/?$ $1?cp=all [QSA,L]

    think you can help? cheers!

  • 38
    snoogly

    Is there a way to automatically clear the Name and Mail input text area after the comment is submitted? For privacy I need that infor to be cleared after submission.

  • 39
    Lonnie West

    How do you get the comments to all be displayed automatically on this page instead of forcing the user to click the usual ‘comments link’ to see them?

    I’ve been trying to find out how to do that on my site for days now with no luck…

    Help?

  • 40
    Keyvan

    Lonnie, I’m not quite sure I understand your question. As far as I know most WordPress themes will display all comments associated with a post (or page) when that post (or page) is viewed on its own. So I’m not doing anything special to display comments on this page, you’re simply viewing a single entry. I think the comments link only appears when you’re viewing a number of posts (e.g. the latest posts displayed on the homepage). Let me know if I’ve misunderstood your question.

  • 41
    Keyvan

    Snoogly, I’m sure there must be an easier way to do this (maybe even through the admin interface), but here’s one solution: Open the comments-paged.php template file you’re using and remove the PHP code from the value attribute of the input elements. (I’ve highlighted the relevant code to remove from the snippet below.)

    <p><input type="text" name="author" id="author" value="<?php
      echo $comment_author; ?>" size="22" tabindex="1" />
    <label for="author"><small>Name <?php
      if ($req) echo "(required)"; ?></small></label></p>
    <p><input type="text" name="email" id="email" value="<?php
      echo $comment_author_email; ?>" size="22" tabindex="2" />
    <label for="email"><small>Mail (will not be published) <?php
      if ($req) echo "(required)"; ?></small></label></p>
    <p><input type="text" name="url" id="url" value="<?php
      echo $comment_author_url; ?>" size="22" tabindex="3" />
    <label for="url"><small>Website</small></label></p>
  • 42
    Keyvan

    Gio, sorry for the late reply. I’m afraid I don’t know why you’re having problems with fancy URL enabled. You should only be getting 404 if the rewrite rules aren’t working, but you say the WP generated rules are working. Have you checked to make sure WP isn’t overwriting the plugin’s rules you’ve manually added when it’s updating the htaccess file?

  • 43
    Snoogly

    Thanks! That works perfectly, and was VERY easy to do. Other suggestions I have seen were much more complicated.

    I have another question: I don’t need visitors to enter their Website, but I would like them to enter their student ID number (this is a site for university students). Is it possible for users to enter their ID number into the Website field, and then make that field required?

  • 44
    Jesse

    Nice plugin. Thanks!

  • 45
    Steve Weintraub

    Thank you SO MUCH for this plugin! It worked perfectly, and was a breeze to modify to fit my template. You can see it in action here:
    http://www.automatorworld.com/?p=56

  • 46
    Steve Weintraub

    Problem:
    I have my comments set to descending order. The problem with this is if I have 8 total comments, page 1 will have 3 comments, and page 2 will have 5.

    Is it possible to have an option (or hack) to reverse this? So that page 1 of comments will always be full (5) and page 2 will have 3 comments, and back fill from there?

  • 47
    Keyvan

    Steve, this issue has already been raised. I responded saying I’d try and include an option to enable the alternate behaviour. Unfortunately I haven’t had a chance yet, but as it’s now the single most requested feature (2 requests!) :) I’ll try to release something in the next few days.

  • 48
    Steve Weintraub

    The mob has spoken! :)
    Thanks so much for addressing this Keyvan, I look forward to the new version.

  • 49
    Keyvan

    Steve, the new version is now available. I had so much on I couldn’t get it done sooner. You can either download the new paged-comments.php file (making sure you copy over your current configuration) or copy and paste the minor changes into your existing paged-comments.php file.

    If you do get a chance to try it, let me know if it works okay. Thanks.

  • 50
    Steve Weintraub

    It works perfectly, thanks so much.

  • 51
    mary

    Nice plugin. Thanks!

  • 52
    Taimur Khan

    I installed the plug-in and it was working well for all the test comments I posted, except for the fact that when I posted the 11th comment, the last ten disappeared and there was no page number visible through which the previous comments could be accessed. The number of responses, etc. was all there but the previous comments that had be relegated to another page were simply not accessible as there was no comments page number visible. I have disabled the plug-in on my site for now but would really like to have it for my Guest Book.

    Could you please tell me what is the code for comment page number and where does it reside?

    Thank you.

  • 53
    Keyvan

    Taimur, the comments-paged.php template file pulls in the page numbers. Here’s a snippet from comments-paged.php (taken from the plugin’s /themes/default/ folder):

    <!-- Comment page numbers -->
    <?php if ($paged_comments->pager->num_pages() > 1): ?>
    <p class="comment-page-numbers"><?php _e("Pages:");?><?php
    paged_comments_print_pages(); ?></p>
    <?php endif; ?>
    <!-- End comment page numbers -->

    The best thing to do is enable the plugin, load up the page you’re expecting the page numbers to appear on, and look through the HTML source for the page numbers.

    Let me know if you’re still having problems with the plugin.

  • 54
    Keyvan

    Left that last comment unfinished, sorry. If you do find the page number in the HTML source, but they don’t appear when you’ve viewing the page, then the theme you’re using probably has CSS rules affecting the display of the page numbers. If that’s the case, let me know what theme you’re using and I’ll take a closer look.

  • 55
    Taimur Khan

    Thank you for the quick reply! Yes, the code you mentioned exists in the comments-paged.php file.

    I have enabled the plug-in again and made 12 test posts on this page: http://www.sarangi.info/archives/91

    The descending order of posts has been put into effect by the plug-in but the page numbers do not appear.

  • 56
    Keyvan

    Taimur, I don’t have much time to look into this now. Will try and see what the problem is tonight. I had a quick look at your page’s HTML source and it does not include the page numbers (so no CSS interference). Are you sure you’ve followed all the installation steps? If you are using one of my bundled templates your HTML source should include the comment numbers. I’ll have another look tonight.

  • 57
    Taimur Khan

    I am also using the static frontpage plug-in by Semiologic. Do you think that could interfere with comment page numbers?

    Anyway, thank you very much for your time. I hope I can find an easy solution with your help. Otherwise, please don’t waste too much time on my case.

    Warm regards,
    Taimur.

  • 58
    Taimur Khan

    I use the Default Kubrick theme and did not want this text to appear on my posts pages:

    “This entry was posted on Wednesday, November 16th, 2005 at 12:00 pm and is filed under Events. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. Edit this entry.”

    So I excluded the following script from my single.php file:

    This entry was posted
    post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    on at and is filed under .
    You can follow any responses to this entry through the feed.
    comment_status) && ('open' == $post->ping_status)) {
    // Both Comments and Pings are open ?>
    You can <a href="#respond" rel="nofollow">leave a response</a>, or <a>" rel="trackback">trackback</a> from your own site.
    comment_status) && ('open' == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can <a> " rel="trackback">trackback</a> from your own site.
    comment_status) && !('open' == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.
    comment_status) && !('open' == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    Not only did the above-mentioned text disappear as desired, the paged comment fuction with all the page and comment numbers, etc. started to work normally for me as well. I don’t know why that happened but it did, and I am very happy. Thank you for this excellent plug-in!

  • 59
    Keyvan

    Hi Taimur, I have to admit I’m still a bit baffled as to why it wasn’t working before. It could be that the other plugin was interfering and caching the page - preventing the display of the dynamically generated comment page number - but I really can’t be sure until I try it. I’m glad you’ve managed to get it to work. If you experience any other strange problems, let me know and I’ll try running the two plugins side-by-side myself to see what it could be. Thanks for the update!

  • 60
    Taimur Khan

    Yes, it’s working well now:
    http://www.sarangi.info/archives/91

    Using the Static Frontpage plug-in by Semiologic is not a problem as I even tried turing it on and off to no avail, and am using it still. The paged comments plug-in started working normally only when I deleted the script from the single.php for quite another reason (mentioned in my last response) - mere coincidence it was…

  • 61
    Florian

    Hello Keyvan,
    sorry but the plugin is not working for me. I always get the message: “Sorry but comments are closed…” when I activate it, but that’s not true. I activated all comment options but it won’t work.

    Any Ideas?

  • 62
    Florian

    Hm, I figured it out, works now. Thank’s anyway!

  • 63
    Aaron Brazell

    Has this plugin been updated and tested to successfully under WordPress 2.0?

  • 64
    Keyvan

    Aaron: Not yet. I will be testing it as soon as I get the chance. (If anyone else has tried running it under WP2, please post up and let me know.)

  • 65
    Jonathan

    Great plugin, I’ll definitaly make use of it when I change my guestbook over to Wordpress.

    I have found just one slight problem. A really nice feature of Wordpress comments is way new comments appear to the person who submitted them with the label “Your comment is awaiting moderation”, while no-one else can see them. With your paged comment plugin, this no longer works. The comment is completely invisible to everyone until it has been approved.

    I fixed this by copying the necessary code to checks the user’s name and e-mail from comment-functions.php

  • 66
    Keyvan

    Hi Jonathan,
    Thanks for flagging this up. You’re right that it’s a useful feature. I’ve just tried to think of my original reason (it was intentional) for disabling it, but I can’t remember it now. :) I think I did consider adding it as an option, so it wouldn’t have been a serious issue. Hmmm, if the reason doesn’t come to me soon I’ll work it back into the next version. Thanks again for raising the issue.

  • 67
    blogito ergo sum – Articles » Playing with plugins

    [...] Several plugins that might be useful if my post readership increases by several orders of magnitude: 1) WordPress Email Notification. If readership includes non-blogophiles who don’t know an RSS feed from a pig trough. http://watershedstudio.com/portfolio/software/wp-email-notification.ht ml 2) Subscribe to Comments. Allows readers to subscribe to the comments of a post by email, and manage their subscriptions. Ditto to previous for comments. http://www.scriptygoddess.com/archives/2004/06/03/wp-subscribe-to-comm ents/ 3) Paged Comments. Allows comments to be split across multiple pages. http://www.keyvan.net/code/paged-comments/ [...]

  • 68
    Chris Eilers

    Thanks for a great plugin, which I’ve installed on a trial blog at http://www.onlineresumesandcvs.com/blog/. Have also installed the code for excluding the blog entry on follow-on comment pages that you wrote for Massimo.

    Is there an equally simple way of excluding a postmetadata paragraph (on copyright and the post date of the blog entry) on the follow-on comment pages?

    I’ve got a number of other questions of lesser importance, and don’t mean to take you away from your Ajaxing, which looks promising. :-)

    Is there an easy way to insert the_title() into the else statement you wrote above? I tried the following but the title doesn’t display:

    <?php if (!isset($_GET['cp'])) {
      the_content(’<p>Read the rest of this entry</p>’);
    } else {
      echo ‘<p>You are browsing a page of comments on “<?php
        the_title(); ?>”. Read “<?php the_title(); ?>” <a href="’,
        get_permalink(), ‘">here</a>.</p>’;
    } ?>

    Can “(Show All)” be included in your (current, stable, non-Ajax) plugin? I notice you have “(Show All)” as well as numbered links on your main plugin page at http://www.keyvan.net/code/paged-comments/, and I think this could be useful for some users.

    Is it possible to remove the comments box (and associated code) from all except the (most-recent) comment page?

  • 69
    Tim

    I tested your plugin with wordpress 2.0.
    It seems to be working fine, except for the rewrite rules. They are broken and result in 404 errors. Updated rules would be appreciated.

  • 70
    jakob

    hi k

    in wp2.0 the url-rewrite messes up, can you fix.

    have a look here

    rgds
    jakob

  • 71
    Dayna

    This is a very useful plugin. :)

    Is there any way to fix the issue about the rewrite rules? I’m using WordPress 2.0

    Thank you.

  • 72
    Keyvan

    WordPress 2 URL fix:

    Open paged-comments.php and find the ‘=== END EDITING ===’ lines. After the two lines paste the code below. In WP2 the rules for determining the requested page/post have been moved out of the .htaccess file and into PHP code. I couldn’t figure out the best way to hook into the rewrite process, so I’ve opted for a simpler approach: before WP’s parse_request kicks in, we look for the URL segment identifying the comment page, note the comment page number and strip it out of the REQUEST_URI so WP doesn’t kick up a fuss when it comes to parse the request itself. I’ve not tested this extensively, so please treat with care and report any problems. Thanks. (Still a bit rushed so not had a chance to release a new version or update the instructions.)

    Note: If you’re setting this up on WP2, please disregard step 7 as it’s no longer required. (In fact, the new rewrite rule in WP2 matches pretty much any URL structure so the additional rules in step 7 won’t even be evaluated if you do include them.)

    if ($paged_comments->fancy_url) {
        add_action('init', 'paged_comments_fancy_url');
    }
    function paged_comments_fancy_url()
    {
        $req = rtrim($_SERVER['REQUEST_URI'], ‘/’);
        if (preg_match(’!^(.+/)comment-page-([0-9]+)$!’, $req, $match)) {
            $_GET['cp'] = $match[2];
            $req = $match[1];
        } elseif (preg_match(’!^(.+/)all-comments$!’, $req, $match)) {
            $_GET['cp'] = ‘all’;
            $req = $match[1];
        }
        $_SERVER['REQUEST_URI'] = $req;
    }

    You can view the changes in the project’s trunk at the WP Plugin Repository.

  • 73
    Dayna

    Hi Keyvan,

    I’ve tested out the fix you’ve given on my WordPress 2.0 and there’s no problem with it, working great. Thank you :)

  • 74
    Keyvan

    Thanks for reporting back Dayna! Good to know it’s working for you. Hope it does for others as well. :)

  • 75
    Dayna

    Hi, I’m here again, I’ve got a minor question.

    The comments number is a bit odd now.

    http://liberta.espoireve.com/essence/guest-book/comment-page-2/

    The comments number starts with 1 for the latest comment, if you click on page 1, the first comment is still 1.

    I’m using this code by CodeForged to generate the comments number, is there a way to fix it.

    Thank you.

  • 76
    Tim Boucher

    This looks like an awesome plugin! Thanks for all the work you’ve done on it, Keyvan.

    I have a question about a possible modification though. If you point me to any possible resources to help me out, I’d appreciate it. What I’m looking for is very similar to what you’ve done here with a few small differences.

    (1) By default, all comments would be shown on a post page, and the paging would come into play as described below.

    (2) I’d like for the permalink for a comment to point to an individual comment page. The comment page would feature the title and excerpt from my original post, plus some text that says “This is a comment page, etc etc”. And then there would be buttons that say “view all comments,” “leave a comment,” and “Previous” and “Next.”

    Does this sound like something I could easily build based on your existing plugin code, or would it require a lot of changes? I don’t have a ton of raw PHP programming experience, so any pointers and resources you could throw my way would be very much appreciated. An email or response here would be great!

  • 77
    » WP Plugins Galore @ Ambot ah! [ technology news and reviews ]

    [...] Paged Comments - very sueful if you have entries with hundreds or even thousands of comments. [...]

  • 78
    Keyvan

    Hi all, I will respond to the questions, but I still need a few more days.

  • 79
    Technical Assistance Request! - Pop Occulture

    [...] Overall, it’s probably not the world’s hardest plugin to build, especially since you might be able to re-purpose some of the code from Keyvan’s paged comments plugin (which is sort of similar, but not quite). If there’s anybody who’d like to help a brother out with this, let me know. I don’t really have any money to throw at you, thanks to my upcoming move. But maybe we could trade a little bit of freelance design, or some kind of other arrangement. Or you could do it just cause you like me so much and want to help a brother out. That works too! Either way, drop me an email. Thanks! Read Similar Articles: [...]

  • 80
    Aleister

    Very nice plugin. Just what I was looking for. Works great! :)

  • 81
    BloggingTom

    WP Paged Comments Plugin

    Kommentare zu Postings können manchmal ganz schön unübersichtlich werden, und mit der Anzahl der Kommentare steigt auch die Ladezeit der Seite. Dies ist auch beim Post “Die Eypo AG schlägt zurück“, einem der beliebtesten Artikel auf d…

  • 82
    Improving the readability of large numbers of comments — cre8d design blog

    [...] Split things up - I’m 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 page. [...]

  • 83
    Dayna

    Hi Keyvan,

    Thanks for updating this plugin so that it’s working great with WordPress 2.0. I wanted paged comments for all my pages not posts, is it possible to add an option for it so that I don’t have to add the custom field to all my pages?

    Thank you.

  • 84
    Sanjay M

    Thank you very much for your plugin, I’m finding it very useful for my site. It really speeds up page access by limiting the page size and is a big boon! :-)

  • 85
    Sean Hyde-Moyer

    Hi Keyvan,

    The plugin looks awesome!

    But I’m having no luck getting to work:

    WordPress 2.0, Connection-Reloaded v1.2.2 Theme (sort-of)

    I’ve installed the bits in the proper places, and I’m using the “comments-paged.php” from the Default folder. I’ve also renamed paged-comments-config.php.

    I think it’s the replacement of comments_template()that the problem.

    The Connection-Reloaded them has:

    single.php
    page.php
    pages.php

    page.php does not contain any invocation oh comments_template(), pages contains one (which I replaced).

    With the plugin activated, I see no effect. I have a post with 12 comments, no pagination, and the main index seems to have some basic pagination that has nothing to do with your file.

    I’m stumpped!

    Thanks for your time (and the plugin!)
    Sean Hyde-Moyer

  • 86
    Keyvan

    Sorry for the late reply. I’ll try and answer a few of the questions…

    Chris: I’ve tried to answer some of your questions on the FAQ.

    If you’re still having trouble with inserting the title, it’s likely to do with the use of <?php> tags in your code snippet. Try changing

    <?php if (!isset($_GET['cp'])) {
      the_content(’<p>Read the rest of this entry</p>’);
    } else {
      echo ‘<p>You are browsing a page of comments on “<?php
        the_title(); ?>”. Read “<?php the_title(); ?>” <a href="’,
        get_permalink(), ‘">here</a>.</p>’;
    } ?>

    to

    <?php if (!isset($_GET['cp'])) {
      the_content(’<p>Read the rest of this entry</p>’);
    } else {
      echo ‘<p>You are browsing a page of comments on "’,
      the_title(”,”,false), ‘". Read the full story <a href="’,
        get_permalink(), ‘">here</a>.</p>’;
    } ?>

    (The arguments to the_title() ensure the value is returned and not printed, your echo statement does that for you.)

    I know you had some other questions, if you’d still like me to have a go at answering them, let me know. (This reply is quite late so you might have figured out the solution to the other problems by now.)

    Tim: What you’re asking for is possible, but I don’t have the time to do it myself. Setting the comments per page value to 1 should show you one comment per page. This will also give you a URL for each comment, but these URLs won’t be very reliable as permalinks—deleting one comment will affect the page numbers and therefore the permalink. Ideally you’d want the comment ID (which currently appears as a fragment identifier of the URL) to be part of the URL as a path segment.

    Dayna: Thanks for the suggestion. I’ll include an option in the next version. Here’s one solution you can use now. If your theme has a separate template file for pages (the default theme has single.php and page.php) you can edit single.php and remove the call to paged_comments_template() (to return it to the state it was in prior to step 5). This will remove paging from all posts and will bypass the Paged Comments plugin completely.

    Sean: Can you provide the URL of the post with comments on. If Paged Comments is not enabled through the admin panel then everything will work as before. If you give me a URL I can check to see from the HTML source if the comments-paged.php template file is being used or not.

  • 87
    Sean Hyde-Moyer

    Got it!

    There was a readme in the Themes>Default folder:

    ADDITIONAL NOTES:

    You can enable commenting on pages by adding the line:

    php if (function_exists('paged_comments_template'))
         paged_comments_template(); else comments_template(); 

    above the php get_sidebar(); line in page.php

    Following this additional step made it all good.

    Now I just have to figure out why it nuked my live preview window…};^)

  • 88
    Dayna

    Thanks loads Keyvan. Got it working already! =)

  • 89
    Keyvan

    Sean: The plugin uses the comments-paged.php template instead of comments.php. If you’re careful, you can open the two templates (comments-paged.php and comments.php) side by side and try to move over the code from comments.php to comments-paged.php (while preserving the plugin-related code).

    When I get more time, I’ll write a brief guide for theme authors, showing how to build a comments-paged template. (It’s not too difficult to figure out by looking at the code).

  • 90
    Vinu

    Boss,
    Cal i have a copy of this Theme “keyvan”?

    Thanks alot for the Plug-in…
    Can we add more fields? like Location, Gender…etc?

    Vinu

  • 91
    Kenny

    I’m noticing people starting to complain about Ajax plugins and how it makes sites slow. I my self have noticed running more than a couple ajax plugins that my site starts to crawl while loading the java calls in the header. Are you going to do away with the non ajax paged comments plugin? Good work either way.

  • 92
    Keyvan

    Vinu: I don’t have the theme packaged up, and never intended to distribute it, but feel free to use the CSS if it’s for non-commercial use.

    Extra fields I think are best left to another plugin.

    Kenny: Thanks for the comment. I’m not too fond of Ajax myself. The non-Ajax version will remain and if/when I get time to integrate an Ajax mode, it will fall back to non-Ajax mode when an unsupported browser is encountered. And, of course, there’ll be an option to disable Ajax completely.

    The Ajax version will also only be compatible with WordPress 2. I haven’t looked into WP2 much, but as far as I know it comes bundled with Javascript libraries that plugins can make use of. If that’s the case, it’ll save me having to supply JS files and saves users time if the WP2 JS files are being shared (and loaded only once).

    I’ve not had much time lately to work on the Ajax version, so I don’t think I’ll have a release ready anytime soon.

  • 93
    Guig

    Hi, I was wondering how to apply this plugin to popup comments.

  • 94
    Keyvan

    Guig, I’m afraid I don’t know. I’ve never tried popup comments. I’ll look into it when I get a chance.

  • 95
    082net

    Hi Keyvan,

    First of all, thanks for your great work. I’m so appreciated.
    I made a modified version of ‘Threaded and Paged Comments(by Trustin)’ plugin, and named it ‘tp-guestbook’.

    It’s based on ‘Paged comments(Yours)’ and ‘Brian’s Threaded Comments’.

    I tried to send a trackback, but my post is in ‘korean’(I’m not so good at english) :(

    You can check it Here

  • 96
    Keyvan

    Hi 082net, thanks for the work—it looks very good. I’ve included a link in the related downloads section above. I still haven’t got round to installing Trustin’s plugin, but when I do, I’ll try this as well.

  • 97
    082net

    I’m pleased to see the link included on this page.
    I never thought that :)

    Thanks for those good words to my work.
    (Is this right expression?…I hope)

  • 98
    tanster

    Hi Keyvan,

    Thanks for a great plugin!

    Have a question: my comment numbering is not correct when I use ordering = DESC + fill_last_page = true.

    Here’s what I have:
    • A post with 12 comments
    • Config settings:
    all_posts = true
    per_page = 10
    ordering = desc
    page_range = 5
    fancy_url = false
    show_all_option = true
    fill_last_page = true
    • WordPress 2.0 + Default Theme + unchanged Default comments-paged.php + no fancy permalinks

    What I see:
    • Comments page 2 is INCORRECT: Newest comment is numbered “20”, with comments that appear below it on the same page numbered 19-11 (newest comment should be numbered “12”, with comments that appear below it on same page numbered 11-3)
    • Comments page 1 is CORRECT: Top comment numbered “2”, next comment numbered “1”

    If I change fill_last_page = false, then everything works correctly:
    • Comments page 2: Top (newest) comment numbered “12”, with comment that appears below it numbered “11”.
    • Comments page 1: Comments numbered “10” through 1” from top to bottom.

    What am I doing wrong? This also happens with the unchanged Classic comments-paged.php template.

    Thank you!
    :) tanster

  • 99
    Keyvan

    Tanster, you’re not doing anything wrong. I think you’ve identified a bug in the code. Expect a fix tomorrow. I don’t think I updated the numbering procedure when I introduced the fill_last_page feature. Thanks for flagging this up and including a detailed report.

  • 100
    tanster

    Wow, thanks Kevan for the quick reply! I look forward to seeing your next version.

    :) tanster

  • 101
    Keyvan

    Tanster, here’s the fix for the comment number problem:

    Open paged-comments.php and find the following lines (should start from line 117) in the paged_comments_template() function:

    // comment numbering
    $comment_number = ...snipped...
    if ($paged_comments->ordering == 'DESC') {
        $comment_number += count($comments);
        $comment_delta = -1;
    } else {
        $comment_number += 1;
        $comment_delta = 1;
    }

    change to:

    // comment numbering
    $comment_number = ...snipped...
    if ($paged_comments->ordering == 'DESC') {
        $comment_mod = $comment_count % $paged_comments->pager->get_items_per_page();
        if ($paged_comments->fill_last_page && ($comment_mod != 0)) {
            $comment_number += $comment_mod;
        } else {
            $comment_number += count($comments);
        }
        $comment_delta = -1;
    } else {
        $comment_number += 1;
        $comment_delta = 1;
    }

    [Edited: 2006-02-17]

    That should do it. Let me know how you get on. I don’t have time to put out a new version yet, but the fix will be in the new version when it’s ready.

  • 102
    tanster

    Hi Keyvan,

    The new code works BEAUTIFULLY! I have it running in my sandbox; as soon as it’s public, I will let you know.

    Thanks again for being so responsive!

    :) tanster

  • 103
    Dayna

    Hi Keyvan,

    Is it all right for you to tell me how you achieve the permalinks to the comments with the paged comments?

    like

    http://www.keyvan.net/code/paged-comments/comment-page-11/#comment-1900

    instead of

    http://www.keyvan.net/code/paged-comments/#comment-1900

    Thanks :)

  • 104
    tanster

    Hi Keyvan,

    I see that paged comments uses comments-paged.php as its template, and if I click “Show All” then regular comments use whatever comments.php file is in my current theme.

    I am using a theme, however, which doesn’t number the comments.

    My question is: how do I get my standard comments.php file to display numbers in the comments just like comments-paged.php? (Just like it works here at http://www.keyvan.net/code/paged-comments/)

    Thanks!
    :) tanster

  • 105
    Dayna

    tanster: I’m not sure if it’s the right way but this is how I do it

    add $commentcount=1;

    after $oddcomment = 'alt'; at the top of your comments.php

    and where you want the comment number to appear, use this

    echo $commentcount++;

    :)

  • 106
    Keyvan

    Dayna: If you’re using one of the bundled templates, you should have a call to this function within the comment loop:

    echo paged_comments_url('comment-'.get_comment_ID());

    The function returns the ‘permalink’ URL of a comment—it’s not perfect and I’m working on a better solution for a future release. The function will also take into consideration the current comment page. So, for example, when you load this page the last comment-page is active (at the moment page 11) but the page URL doesn’t contain the /comment-page-11/ path segement. So returning ‘#comment-1911′ is not enough as someone might link to, like in your example, http://www.keyvan.net/code/paged-comments/#comment-1911 (which is only valid while comment page 11 is being loaded by default). So paged_comments_url will (at least it does for me :)) return http://www.keyvan.net/code/paged-comments/comment-page-11/#comment-1911.

    Please check and let me know if paged_comments_url() is being used in your comments-paged.php template. If it’s not working right I’ll have to look into it some more.

    I mentioned above that I’m working on a better solution that will—if I implement it correctly :)—produce URLs with no reference to the comment page, somethine like: http://www.keyvan.net/code/paged-comments/comment-1911/.
    I’m hoping the code can then look at the paged-comments configuration to figure out, and redirect to, the correct comment page. (Not even sure if this is the ideal solution yet!) :)

    Tanster: I’m not too happy with the way it works at the moment (ie. having to maintain two comment templates). If you’re only after the comment numbers, you can do what Dayna suggested.

    The next version will always use the comments-paged.php template while the plugin is active within WordPress. (Deactivating will revert back to comments.php.) I’m actually using the development version on this site, which only uses comments-paged.php (so when you choose ’show all’ you’re still getting comments-paged.php). If you’re brave enough, you can load it and try it: paged-comments.php. You don’t need to make changes to your config file, but there is a new option available:

    // Show-all comment ordering
    // -------------------------
    // Determines how comments are ordered when loaded on a single page.
    // The default ascending ('ASC') order means comments will be ordered with
    // the earliest comment displayed first. 'DESC' reverses this order.
    // The ordering specified here is used in the following circumstances:
    // 1. When a user chooses the 'Show All' option to have all comments displayed at once.
    // 2. When the total number of comments has not exceeded the per_page value (ie. when
    //    they're few enough to fit on a single comment page).
    // In all other circumstances, the value specified in ordering is used.
    $paged_comments->show_all_ordering = 'ASC';

    Hope that helps.

  • 107
    tanster

    Dayna: Thank you, that works like a charm!

    Keyvan: Thanks for the updated paged-comments.php; I’m not brave enough to use it, though! ;)

    Also, looks like I spoke too soon about the numbering working correctly in fill_last_page mode:

    Up to 19 comments, it works fine:
    - Page 2, 10 comments numbered “19″ through “10″
    - Page 1, 9 comments numbered “9″ through “1″

    Once I have 20 comments, this is what I see:
    - Page 2, 10 comments numbered “10″ through “1″ (should be “20″ through “11″)
    - Page 1, 10 comments numbered “0″ through “-9″ (should be “10″ through “1″)

    My settings:
    - all_posts = true;
    - per_page = 10;
    - ordering = ‘DESC’;
    - page_range = 5;
    - fancy_url = false;
    - show_all_option = true;
    - fill_last_page = true;

    Thanks!
    :) Jennie

  • 108
    Keyvan

    Hi Tanster,
    Sorry about that. Even the most basic maths still trips me up. :) I’ve corrected the code I posted earlier. Please try it and let me know if it works. (It’s looking quite ugly now—I’m sure there’s a very elegant mathematical solution out there somewhere!)

  • 109
    tanster

    That fixed it, Keyvan. Once again, thank you!

    :) tanster

  • 110
    tanster

    Okay, paged comments are now functional on my site:

    http://www.officetally.com/?p=35#comments

    The theme being used is a modified version of the “Neat!” theme at http://www.aamukaste.org/wpthemes/?cat=3

    :) tanster

  • 111
    Dayna

    Keyvan: Thanks, it’s working now. :) Good luck in the new version. And a question regarding the new version, you mentioned to use the comments-paged.php whenever the plugin is activated. So what if I only want paged comments for my pages and not posts?

  • 112
    Keyvan

    Tanster: Nice site! Glad the plugin’s finally working okay. :)

    Dayna: Glad it’s working. Just curious, was it the URL function I mentioned, or something else?

    Regarding the template file and paging. I’m still going to add your suggestion of an option to restrict paging to posts or pages. The idea behind using a single comments template is to make maintenance of the template file easier. The way the plugin works at the moment means users have to maintain two comment templates (comments.php and comments-paged.php). So to get a consistent theme you end up having to duplicate any template changes you make in one template to the other.

    When I say the plugin will always use comments-paged.php in a future version, I don’t mean it’ll force paging. Just that while the plugin is active you’ll only have to worry about the one template—so, as before, you’ll still see all comments on a single page if paging isn’t enabled. I hope that makes sense. I think I’ve confused myself talking about it! (And having a template called comments-paged.php will probably cause even more confusion when this change comes into effect!) :) I’m open to suggestions though. If you think this is bad idea, or if you can think of something better, let me know.

  • 113
    tanster

    Thanks Keyvan! I’m really happy with how it turned out.

    :) tanster

  • 114
    Dayna

    Yup, it was the one with the

    /comment-page-1/#comment-687

    Right, I like that idea I think it would be rather convienient as well. :)

  • 115
    Jonathan

    Thanks for updating the plugin to support Wordpress 2 fully.

    I have one slight issue with the fancy URL feature which caused issues with a non-wordpress part of my site (and which I can see interfering with other plugins).

    The first line of your code strips off the trailing “/” if there is one. This is then written back to the variable $_SERVER['REQUEST_URI'] even if the page in question is not a comments page, or indeed even if it’s not a Wordpress page.

    I’ve changed your code so that $_SERVER['REQUEST_URI'] = $req; is inside each of the “if” statements, so that the URI is untouched if it doesn’t refer to a comments page.

    (Part of my site checked for a trailing “/” and added it if it wasn’t there. So I had an infinite loop! I know there’s a plugin that does this for Wordpress pages too!)

  • 116
    Keyvan

    Thanks Jonathan. I should be more careful tampering with these things. I’ll try and put out a new release tonight with this change. Hope it didn’t waste too much of your time pinning the problem down (I know these infinite loops can be a bit of nightmare to resolve). Thanks for letting me know.

  • 117
    Jonathan

    Not at all, Keyvan, you’ve already implemented the “Comment awaiting moderation” feature I suggested a while ago; and from your code, I now understand how Wordpress 2 handles permalinks! I actually tracked down the looping redirects quite quickly (which is unusual for me!) after I noticed the 301s in the access log! For normal Wordpress pages it shouldn’t matter as they don’t care about the “/”. I just want all my pages indexed with it there for consistency!

  • 118
    Keyvan

    New bug-fix release is now available for download. Fixes the trailing slash issue and the comment numbering issue when DESC and fill_last_page are both enabled. Thanks to Jonathan and Tanster. No new features introduced in this release, but I recommend you upgrade. (Which just involves replacing paged-comments.php if you’ve already got your paged-comments-config file in place.)

  • 119