[wp-hackers] Child Themes in OOP flavour
Filippo Pisano
filippo.pisano at gmail.com
Mon Dec 2 08:25:20 UTC 2013
A fast update on this topic. I used the approach you guys suggested (thank
you) and it worked flawlessly.
Just a side note on the implementation. I had to use a utility function to
create classes instances like this:
// Use this function to instantiate classes inside themes
function my_theme_instance($class){
// Check if we are inside child theme and action has not been called.
This means that we are trying to instantiate parent theme
if(is_child_theme() && did_action("after_setup_theme") === 0){
return false;
}
elseif(class_exists($class)){
return new $class;
}
}
Hope this helps.
Cheers
Filippo Pisano
cel: 3291821355 / skype: filippopisano
On Fri, Nov 29, 2013 at 12:35 PM, Otto <otto at ottodestruct.com> wrote:
> On Fri, Nov 29, 2013 at 5:01 AM, Thomas Scholz <info at toscho.de> wrote:
>
> > Offer a custom action in your parent theme:
> >
> >
> Slightly easier way: Just wrap the child's classes in a function hooked to
> after_setup_theme. Then the parent will be loaded and you can extend it as
> you like.
>
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list