Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#17778 closed defect (bug) (fixed)

get_comment_pages_count() returns > 1 when pagination is disabled

Reported by: dd32's profile dd32 Owned by: nacin's profile nacin
Milestone: 3.7 Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: has-patch commit
Focuses: Cc:

Description

If pagination is disabled, get_comment_pages_count() will still return the number of pages possible if pagination was enabled.

As a workaround, themes & TwentyEleven are having to get to see if pagination is enabled first:

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>

I'd suggest that if comment pagination is not enabled, this function should return 0 or 1 (0 = no comments, 1 = 1 page).

The addition of an extra block after the empty comments check would be:

if ( ! get_option('page_comments') )
	return 1;

Attachments (3)

comment.php.patch (537 bytes) - added by kobenland 13 years ago.
17778.patch (4.3 KB) - added by jakub.tyrcha 13 years ago.
17778.refresh.patch (413 bytes) - added by c3mdigital 11 years ago.
Refresh of original patch

Download all attachments as: .zip

Change History (9)

#1 @kobenland
13 years ago

  • Cc kobenland added

#2 @jakub.tyrcha
13 years ago

  • Keywords has-patch added

Refreshed and tweaked the patch, + updated formatting in the function

@jakub.tyrcha
13 years ago

@c3mdigital
11 years ago

Refresh of original patch

#3 @c3mdigital
11 years ago

  • Version changed from 3.2 to 2.7

#4 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#5 @SergeyBiryukov
11 years ago

  • Keywords commit added

#6 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 25126:

Return 1 from get_comment_pages_count() when pagination is disabled.

props obenland.
fixes #17778.

Note: See TracTickets for help on using tickets.