[theme-reviewers] Child themes discussion

Philip M. Hofer (Frumph) philip at frumph.net
Sat Jan 22 18:18:27 UTC 2011


just an fyi the function for get_template_part utilizes more resources then 
just a get_template_(directory/uri) especially if predefines made for 
get_template_ are made ahead of time in the theme, if we're talking high 
traffic sites it's really not a good idea to use get_template_part for 
anything besides specific .php part files, but not good for .js / .css loads



----- Original Message ----- 
From: "Otto" <otto at ottodestruct.com>
To: <theme-reviewers at lists.wordpress.org>
Sent: Saturday, January 22, 2011 10:15 AM
Subject: Re: [theme-reviewers] Child themes discussion


> On Sat, Jan 22, 2011 at 12:12 PM, Chip Bennett <chip at chipbennett.net> 
> wrote:
>> So, are we saying that for Themes that are *intended* to be Child-Theme
>> ready, they must use get_template_, rather than get_stylesheet_, in all
>> instances?
>
> Nothing is ever that simple. :)
>
> Stylesheet functions always return the path to the active theme.
>
> Template functions *can* return the path to the parent theme, if you
> have a parent.
>
> Generally speaking, it's a bad idea to use either one except in
> specialized contexts.
>
> To get and include a PHP file, for example, the safest way is
> get_template_part('file'). This does the proper searching for the file
> in the child and the parent (along with handling the special file-name
> / file fallback cases for get_template_part('file','name').
>
> You *can* use locate_template to just get the local path of a file in
> the child/parent. A simple locate_template('file.png') would do the
> trick. It only tries to load the file as php for the case of the
> second parameter being true. This doesn't help if you need a URL.
>
> I don't know of a good way to allow image/css file overrides in a
> child, since you need the URL of them. Maybe somebody else can
> enlighten me?
>
> -Otto
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 




More information about the theme-reviewers mailing list