[wp-trac] [WordPress Trac] #8168: Using "type" parameter on
wp_list_comments() screws up paging
WordPress Trac
wp-trac at lists.automattic.com
Wed Nov 12 07:50:03 GMT 2008
#8168: Using "type" parameter on wp_list_comments() screws up paging
--------------------------+-------------------------------------------------
Reporter: Viper007Bond | Owner: Viper007Bond
Type: defect | Status: new
Priority: normal | Milestone: 2.8
Component: Comments | Version: 2.7
Severity: normal | Keywords: needs-patch
--------------------------+-------------------------------------------------
'''Who It Affects:'''
Those who use comment paging and either set the `type` parameter on
`wp_list_comments()` or pass a custom `$comments` to that function.
Everyone else (for example, the default theme) is unaffected.
'''What Happens And Why:'''
If you have the latest/newest comments page set to show by default, it can
show up as blank. For example, if you have 22 comments (2 of which are
pings), 5 comments per page, and do `wp_list_comments( array( 'type' =>
'comment' ) )`, you'd end up with 4 pages and the 5th page (which should
no longer exist) being blank. `get_comment_pages_count()` is at fault here
as it's using the wrong total comments number when diving total comments
by comments per page. If you have the oldest page set as the default,
`next/previous_comments_link()` is smart enough (apparently) to not
continue on to the next page.
`get_comment_link()` also ends up using the wrong page number as it's
expecting comments to be displayed that aren't. `get_page_of_comment()` is
at fault here as it's SQL query is grabbing comments that we've excluded.
'''Solution:'''
I spent an hour or two on this last night. Basically what I've been doing
is passing along `$args` to the other various functions. This way they can
realize what's going on and account for it.
--
Ticket URL: <http://trac.wordpress.org/ticket/8168>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list