WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#17568 closed defect (bug) (fixed)

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

Reported by: mfields Owned by: 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 3 years ago.
17568.return-early-from-comments-2.diff (1.0 KB) - added by mfields 3 years ago.
Builds off first patch. Adds comments support for the 'attachment' post_type.
17568-simplify.diff (1.3 KB) - added by duck_ 3 years ago.
17568-simplify-with-attachment-comments.diff (1.7 KB) - added by duck_ 3 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 mfields3 years ago

  • Cc michael@… added

comment:2 scribu3 years ago

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

comment:3 iandstewart3 years ago

This patch looks like a good enhancement to me.

comment:4 greenshady3 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().

comment:5 scribu3 years ago

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

mfields3 years ago

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

comment:6 iandstewart3 years ago

  • Keywords dev-feedback added

duck_3 years ago

comment:7 duck_3 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.

comment:8 nacin3 years ago

  • Keywords commit added; dev-feedback removed

Much better.

comment:9 dd323 years ago

  • Component changed from Themes to Bundled Theme

comment:10 westi3 years ago

The last patch looks good to me. committing.

comment:11 westi3 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.