[wp-trac] [WordPress Trac] #27425: Templates For Posts Formats

WordPress Trac noreply at wordpress.org
Sat Mar 29 10:29:32 UTC 2014


#27425: Templates For Posts Formats
---------------------------+------------------------------
 Reporter:  hardeepasrani  |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Post Formats   |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  template
---------------------------+------------------------------

Comment (by hardeepasrani):

 Replying to [comment:2 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27425#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list