[wp-hackers] How to number the paged comments in theme Was: Tutorial for custom Walker_Comment ?
william.canino at googlemail.com
Sun Nov 8 18:48:39 UTC 2009
Buggers! get_comment_pages_count() returns more than 1 even if the
get_option('page_comments') setting is off. Therefore I gotta check
Reference: See http://phpxref.ftwr.co.uk/wordpress/wp-includes/comment.php.source.html#l588
A tip to anyone who is off to number the paged comments, too: <ol
start> only works with the "older comments at the top" setting,
because this tag doesn't do reverse numbering.
2009/11/5 William Canino <william.canino at googlemail.com>:
>>> It accepts echo=false without any problem.
> Yes it does. However, I may end up using ( get_comment_pages_count() >
> 1 ) as it is more good-looking. That leaves me with the other
>> 1. My theme has no nested comments, but uses <ol> instead of <ul>
>> How do I number the paged comments (<ol start="?"> to maintain comment
>> numbering. For example, if I chose 10 comments per page, the comments
>> at page two will start at 11. How do I get that 11?
> Do you think
> <ol start="<?php echo ( get_query_var('cpage') - 1 ) *
> get_query_var('comments_per_page') + 1 ?>">
> is okay and wouldn't cause problems or fail later?
> I am just being careful about these undocumented functions.
> 2009/11/5 Mike Little <mike at zed1.com>:
>> 2009/11/5 Andrew Nacin <anacin at gwhatchet.com>
>>> > I don't believe that will work: the default comment_walker *always*
>>> #10948 is for wp_list_comments()... paginate_comments_links() only relies
>>> the walker to determine the number of pages required (and even then only
>>> when threading is on, otherwise it uses $wp_query). It accepts echo=false
>>> without any problem.
>> Doh! That's what I get for not reading things properly, thanks for
>> clarifying that.
>> Mike Little
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
More information about the wp-hackers