Make WordPress Core

Opened 15 years ago

Closed 11 years ago

Last modified 11 years ago

#18859 closed enhancement (fixed)

Single theme template for custom post by slug

Reported by: ericjuden Owned by: SergeyBiryukov
Priority: normal Milestone: 4.4
Component: Themes Version: 3.3
Severity: normal Keywords: has-patch commit
Cc: Focuses: template

Description

I was working on adding a custom template for an individual post in my custom post type and discovered that you could only make a single-{post-type}.php. This patch adds the ability to make single-{post-type}-{slug}.php

It's pretty straight forward, and only adds 1 line of code to wp-includes/theme.php

Attachments (6)

wp-includes-theme.php.patch (358 bytes ) - added by ericjuden 15 years ago.
wp-includes-theme.php.patch
18859.patch (389 bytes ) - added by ocean90 15 years ago.
Relative path.
18859.2.patch (368 bytes ) - added by ericjuden 14 years ago.
Function has moved to template.php
18859.3.patch (401 bytes ) - added by SergeyBiryukov 14 years ago.
Relative path, proper formatting
18859.4.patch (491 bytes ) - added by ericjuden 14 years ago.
Updated for 3.5
18859.5.patch (759 bytes ) - added by johnbillion 11 years ago.

Download all attachments as: .zip

Change History (17)

#1 @chipbennett
15 years ago

  • Keywords needs-testing added

@ericjuden
15 years ago

wp-includes-theme.php.patch

@ocean90
15 years ago

Relative path.

#2 @ocean90
15 years ago

  • Component Post TypesTemplate
  • Keywords dev-feedback added; needs-testing removed

+1 from me.

Pages and Taxonomies are supporting slugs.

#3 @ericjuden
14 years ago

  • Version 3.33.4

#4 @SergeyBiryukov
14 years ago

  • Version 3.43.3

Version field indicates when the enhancement was initially suggested.

#5 @johnbillion
14 years ago

  • Cc johnbillion added

@ericjuden
14 years ago

Function has moved to template.php

#6 @ericjuden
14 years ago

I just updated the patch. The get_single_template() function was moved into wp-includes/template.php as of WordPress 3.4.

@SergeyBiryukov
14 years ago

Relative path, proper formatting

@ericjuden
14 years ago

Updated for 3.5

#7 @sc0ttkclark
14 years ago

  • Cc lol@… added

I'd like this as well, or at the very least {post_type}-{slug}.php like pages get.

#8 @nacin
13 years ago

  • Component TemplateThemes
  • Focuses template added

#9 @johnbillion
11 years ago

  • Keywords commit added; dev-feedback removed
  • Milestone Awaiting Review4.4

It shall be done.

#10 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 34800:

Add single-{post_type}-{post_name}.php to the top of the template hierarchy for single posts.

This is consistent with page and taxonomy templates, which support slugs as well.

Props ericjuden, johnbillion.
Fixes #18859.

#11 @ericjuden
11 years ago

Thanks guys! Glad it finally made it in.

Eric

Note: See TracTickets for help on using tickets.