WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 21 months ago

#17996 closed defect (bug) (fixed)

Twenty Eleven: allow content-single.php to be overridden for post formats

Reported by: SGr33n Owned by: lancewillett
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.2
Component: Bundled Theme Keywords: has-patch needs-testing
Focuses: Cc:

Description

From single.php Line 23:

					<?php get_template_part( 'content', 'single' ); ?>

To:

					<?php get_template_part( 'content', get_post_format() ); ?>

Attachments (4)

17996.diff (514 bytes) - added by CoenJacobs 3 years ago.
Added post format to get template part call
singleformat.patch (1.1 KB) - added by murky 3 years ago.
Patch which maintains current behaviour - but allows child theme to over-ride if wanted
17966b.diff (820 bytes) - added by murky 3 years ago.
A patch which preserves current behaviour, but facilitates the addition of being able to use different post formats on single pages by adding content-single-status.php and similar
17996.2.diff (614 bytes) - added by lancewillett 2 years ago.
Refreshed patch (no need for comment)

Download all attachments as: .zip

Change History (14)

CoenJacobs3 years ago

Added post format to get template part call

comment:1 CoenJacobs3 years ago

  • Cc coenjacobs@… added
  • Keywords needs-testing ui-feedback added

Seems to be true. Don't know why this has never been discovered before.

comment:2 ocean903 years ago

  • Component changed from Themes to Bundled Theme
  • Keywords ui-feedback removed

comment:3 rosshanney3 years ago

I'm not 100% sure, but I believe that this is intentional. The TwentyEleven post format templates (content-aside.php, content-gallery.php, content-image.php etc) contain the following comment at the top:

The template for displaying posts in the ... Post Format on index and archive pages

This seems to imply that they are not intended to be used on single post pages.

comment:4 SGr33n3 years ago

The default templates doesn't display correct on single pages cause they have the excerpt instead of the full content into the_content()... maybe it's intentional.

comment:5 murky3 years ago

I've just done a patch for this....

http://core.trac.wordpress.org/ticket/18108

It maintains current behaviour - but allows an option to over-ride in a child theme.

murky3 years ago

Patch which maintains current behaviour - but allows child theme to over-ride if wanted

comment:6 murky3 years ago

  • Cc murkee@… added

If I've understood this properly (still learning!), the advantage of my suggested patch as that it doesn't require other files in the theme to be updated.

(Update: I've just found out how to do the patch properly - will resubmit soon)

Last edited 3 years ago by murky (previous) (diff)

murky3 years ago

A patch which preserves current behaviour, but facilitates the addition of being able to use different post formats on single pages by adding content-single-status.php and similar

comment:7 nacin2 years ago

I like 17966b.diff. ian or lance?

comment:8 iandstewart2 years ago

17966b.diff is clever. That's a neat enhancement.

lancewillett2 years ago

Refreshed patch (no need for comment)

comment:9 lancewillett21 months ago

  • Milestone changed from Awaiting Review to 3.5
  • Summary changed from Twentyeleven: maybe forgot inclusion of different post formats template? to Twenty Eleven: allow content-single.php to be overridden for post formats

comment:10 lancewillett21 months ago

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

In [21491]:

Twenty Eleven: allow content-single.php to be overridden for post formats, props murky. Closes #17996.

Note: See TracTickets for help on using tickets.