WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years 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 5 years ago.
Added post format to get template part call
singleformat.patch (1.1 KB) - added by murky 5 years ago.
Patch which maintains current behaviour - but allows child theme to over-ride if wanted
17966b.diff (820 bytes) - added by murky 5 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 4 years ago.
Refreshed patch (no need for comment)

Download all attachments as: .zip

Change History (14)

@CoenJacobs
5 years ago

Added post format to get template part call

#1 @CoenJacobs
5 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.

#2 @ocean90
5 years ago

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

#3 @rosshanney
5 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.

#4 @SGr33n
5 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.

#5 @murky
5 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.

@murky
5 years ago

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

#6 @murky
5 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 5 years ago by murky (previous) (diff)

@murky
5 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

#7 @nacin
5 years ago

I like 17966b.diff. ian or lance?

#8 @iandstewart
5 years ago

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

@lancewillett
4 years ago

Refreshed patch (no need for comment)

#9 @lancewillett
4 years 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

#10 @lancewillett
4 years 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.