Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17568 closed defect (bug) (fixed)

"Comments are Closed" even when comments are not supported.

Reported by: mfields's profile mfields Owned by: westi's profile westi
Milestone: 3.2 Priority: normal
Severity: normal Version: 3.2
Component: Bundled Theme Keywords: has-patch commit
Focuses: Cc:

Description

I have a public custom post_type defined via plugin named "extension" which does not support comments. When I view a single extension in Twenty Eleven it displays a "Comments are Closed" message at the bottom of the page. I think that if post_types do not support comments, the comments template should know this and return early.

Attachments (4)

17568.return-early-from-comments.diff (658 bytes) - added by mfields 13 years ago.
17568.return-early-from-comments-2.diff (1.0 KB) - added by mfields 13 years ago.
Builds off first patch. Adds comments support for the 'attachment' post_type.
17568-simplify.diff (1.3 KB) - added by duck_ 13 years ago.
17568-simplify-with-attachment-comments.diff (1.7 KB) - added by duck_ 13 years ago.

Download all attachments as: .zip

Change History (15)

#1 @mfields
13 years ago

  • Cc michael@… added

#2 @scribu
13 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 3.2

#3 @iandstewart
13 years ago

This patch looks like a good enhancement to me.

#4 @greenshady
13 years ago

This patch will disable comments on single attachment pages because comments aren't supported when the attachment post type is registered.

There are two options: 1) Add a check for attachments in the above patch or 2) Add a supports array at the time the attachment post type is registered.

Personally, I like option 2 because I run a similar function in my themes and have just been registering support for comments on attachments using add_post_type_support().

#5 @scribu
13 years ago

+1 on adding 'comments' support to the 'attachment' post type.

@mfields
13 years ago

Builds off first patch. Adds comments support for the 'attachment' post_type.

#6 @iandstewart
13 years ago

  • Keywords dev-feedback added

#7 @duck_
13 years ago

Some concerns in IRC bug scrub about the addition complicating the theme.

Attached 17568-simplify.diff which adds the post_type_supports check to be with the existing ! is_page() check. It also simplifies quite a bit of the logic surrounding the "Comments are closed." note by removing extraneous code and conditional branches.

#8 @nacin
13 years ago

  • Keywords commit added; dev-feedback removed

Much better.

#9 @dd32
13 years ago

  • Component changed from Themes to Bundled Theme

#10 @westi
13 years ago

The last patch looks good to me. committing.

#11 @westi
13 years ago

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

In [18211]:

Only show Comments are Closed when they are supported.
Tidy up the logic to be clearer.
Mark attachements as supporting comments.
Fixes #17568 props duck_

Note: See TracTickets for help on using tickets.