[wp-hackers] Child theme functions.php & processing order

Demetris kikizas at gmail.com
Fri Dec 18 22:36:18 UTC 2009


On Fri, Dec 11, 2009 at 4:02 PM, Otto <otto at ottodestruct.com> wrote:
> On Thu, Dec 10, 2009 at 8:36 PM, Demetris <kikizas at gmail.com> wrote:
>> The child’s functions.php is executed first.
>>
>> I would expect it to be the other way around.  (But I have no idea if
>> it matters. For example, when both parent and child register one
>> function or filter each to the same hook, the order can be adapted
>> with the priority argument. But probably there are scenarios that I’m
>> missing.)
>
> The child is executed first, to allow the child to override the
> parent. Think "pluggable".
>
> Consider this case:
>
> Parent functions.php
>
> if (!function_exists('some_function')) :
> function some_function() {
> ...
> }
> endif;
>
> Child can now override that function merely by declaring it himself,
> but only as long as he's included first.
>
Thanks, Otto!  I hadn’t thought of that -- obviously!

I’ll have to try it now.

Cheers!

Demetris
http://op111.net/


More information about the wp-hackers mailing list