[wp-trac] [WordPress Trac] #7477: Add single-ID.php to template hirearchy

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 6 23:02:08 GMT 2008


#7477: Add single-ID.php to template hirearchy
--------------------------+-------------------------------------------------
 Reporter:  isaacchapman  |       Owner:  anonymous
     Type:  defect        |      Status:  new      
 Priority:  normal        |   Milestone:  2.7      
Component:  Template      |     Version:           
 Severity:  minor         |    Keywords:           
--------------------------+-------------------------------------------------
 This might some people to go a bit over the top in regards to customizing
 how each individual post is displayed, but why not add a single-ID.php
 (where ID is the Post's ID) to the
 [http://codex.wordpress.org/Template_Hierarchy template hierarchy] in a
 similar manner as the category template hierarchy?

 The following replacement for the get_single_template() function in /wp-
 includes/theme.php also includes an apply_filters('single_template') for
 why not reasons:
 {{{
 function get_single_template() {
         global $post;
         $template = '';
         if ( $post && $post->ID && file_exists(TEMPLATEPATH . "/single-" .
 $post->ID . '.php') )
                 $template = TEMPLATEPATH . "/single-" . $post->ID .
 '.php';
         else
                 $template = get_query_template('single');

         return apply_filters('single_template', $template);
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7477>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list