Opened 11 years ago
Last modified 5 years ago
#27425 new enhancement
Templates For Posts Formats
Reported by: | hardeepasrani | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Post Formats | Keywords: | dev-feedback needs-patch |
Focuses: | template | Cc: |
Description
If I opt to use Custom Post Templates, then I can easily put a custom post template by putting a file named single-[name of the custom post], but that same feature is not available for the post formats.
I love the post format feature in WordPress, and people just don't want to use that for some reasons, but this would really attract some of the audience to use the post formats.
For example, a post with Audio format will first look for single-audio.php or single-audioformat.php or anything cuz it single-audio.php may effect the Audio Custom post type.
What do you guys think of this idea?
Change History (6)
#2
follow-up:
↓ 3
@
11 years ago
A workaround:
function use_post_format_templates_27425( $template ) { if ( is_single() && has_post_format() ) { $post_format_template = locate_template( 'single-' . get_post_format() . '.php' ); if ( $post_format_template ) { $template = $post_format_template; } } return $template; } add_filter( 'template_include', 'use_post_format_templates_27425' );
#3
in reply to:
↑ 2
@
11 years ago
Replying to SergeyBiryukov:
A workaround:
function use_post_format_templates_27425( $template ) { if ( is_single() && has_post_format() ) { $post_format_template = locate_template( 'single-' . get_post_format() . '.php' ); if ( $post_format_template ) { $template = $post_format_template; } } return $template; } add_filter( 'template_include', 'use_post_format_templates_27425' );
I know this trick, but a feature like this should be in the core. I love formats option & people do some great stuff with it.
Anyone looking forward to review this ticket of mine?