WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 17 months ago

#18859 new enhancement

Single theme template for custom post by slug

Reported by: ericjuden Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3
Component: Themes Keywords: has-patch dev-feedback
Focuses: template Cc:

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 (5)

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

Download all attachments as: .zip

Change History (13)

comment:1 @chipbennett4 years ago

  • Keywords needs-testing added

@ericjuden4 years ago

wp-includes-theme.php.patch

@ocean903 years ago

Relative path.

comment:2 @ocean903 years ago

  • Component changed from Post Types to Template
  • Keywords dev-feedback added; needs-testing removed

+1 from me.

Pages and Taxonomies are supporting slugs.

comment:3 @ericjuden3 years ago

  • Version changed from 3.3 to 3.4

comment:4 @SergeyBiryukov3 years ago

  • Version changed from 3.4 to 3.3

Version field indicates when the enhancement was initially suggested.

comment:5 @johnbillion3 years ago

  • Cc johnbillion added

@ericjuden3 years ago

Function has moved to template.php

comment:6 @ericjuden3 years ago

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

@SergeyBiryukov3 years ago

Relative path, proper formatting

@ericjuden2 years ago

Updated for 3.5

comment:7 @sc0ttkclark2 years ago

  • Cc lol@… added

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

comment:8 @nacin17 months ago

  • Component changed from Template to Themes
  • Focuses template added
Note: See TracTickets for help on using tickets.