[wp-trac] [WordPress Trac] #13084: Loading Parent Theme functions BEFORE Child Theme functions

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 22 17:09:51 UTC 2010


#13084: Loading Parent Theme functions BEFORE Child Theme functions
--------------------------+-------------------------------------------------
 Reporter:  oncletom      |       Owner:                      
     Type:  defect (bug)  |      Status:  new                 
 Priority:  normal        |   Milestone:  Unassigned          
Component:  Themes        |     Version:  2.9.2               
 Severity:  normal        |    Keywords:  parent, child, theme
--------------------------+-------------------------------------------------
Changes (by demetris):

 * cc: dkikizas@… (added)


Comment:

 One reason it’s done this way is to allow parent themes to make their
 functions pluggable by declaring them conditionally.  E.g., the parent
 says:

 {{{
 if (!function_exists('mega_clever_function')) {
     function mega_clever_function() {
         Do mega clever stuff!
     }
 }
 }}}

 Then the child comes along and does not like {{{mega_clever_function}}}.
 So it simply does:

 {{{
 function mega_clever_function() {
     Do different clever stuff!
 }
 }}}

 You can see examples in the functions.php of the new default theme, Twenty
 Ten.  (But that order of loading the two files was there long before
 2010.)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13084#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list