Make WordPress Core

Opened 20 years ago

Closed 20 years ago

#1408 closed defect (bug) (fixed)

comments_popup_link() returns incorrect URI when there are zero comments [patch]

Reported by: matthewc's profile matthewc Owned by: markjaquith's profile markjaquith
Milestone: Priority: low
Severity: minor Version: 1.5.1.1
Component: General Keywords: comments link bg|commit bg|has-patch
Focuses: Cc:

Description

When popup comments are disabled, the function comments_popup_link() echos the URI permalink#comments even when there are no comments present. In the default template the heading with the id #comments does not exist on the page until the first comment has been submitted. When there are zero comments, comments_popup_link() should echo permalink#respond instead.

My fix for this is as follows:

In comment-functions.php, replace line 121...

comments_link();

with the following...

if (0 == $number) {
  echo get_permalink() . '#respond';
} else {
  comments_link();
}

Attachments (1)

comment-functions.php.diff (575 bytes) - added by markjaquith 20 years ago.
patch for 1.6 SVN

Download all attachments as: .zip

Change History (7)

#1 @Kafkaesqui
20 years ago

This problem exists in the non-popup default comments template as well.

#2 @markjaquith
20 years ago

  • Keywords comments link added
  • Owner changed from anonymous to matt

Sounds good to me. I made a patch for 1.5 branch

#3 @markjaquith
20 years ago

  • Owner changed from matt to markjaquith
  • Status changed from new to assigned
  • Summary changed from comments_popup_link() returns incorrect URI when there are zero comments to comments_popup_link() returns incorrect URI when there are zero comments [patch]

#4 @markjaquith
20 years ago

  • Owner changed from markjaquith to matt
  • Status changed from assigned to new

#5 @markjaquith
20 years ago

  • Keywords bg|commit bg|has-patch added
  • Owner changed from matt to markjaquith
  • Status changed from new to assigned

@markjaquith
20 years ago

patch for 1.6 SVN

#6 @matt
20 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [2685]) Indentation and correct response link when no comments, fixes #1408

Note: See TracTickets for help on using tickets.