[wp-hackers] Bug in get_bloginfo('template_url') w/child themes, or am I doing it wrong?
Mike Schinkel
mikeschinkel at newclarity.net
Wed Mar 10 03:03:42 UTC 2010
On Mar 9, 2010, at 9:36 PM, Jeff Waugh wrote:
> <quote who="Mike Schinkel">
>> I'm wondering if there is a bug in get_bloginfo('template_url') with child
>> themes, or am I doing it wrong?
>> Is this a bug or am I doing this wrong?
>
> Very much NOTABUG: you're looking for stylesheet_url, which provides the URL
> to the child theme directory. template_url is useful when you have resources
> that only make sense as part of the parent template.
Thanks, but not need to shout, it was a reasonable question. :)
So I looked at 'stylesheet_url' and it includes "/style.css." I looked deeper and found get_stylesheet_directory_uri() which is what I need. It would be nice to have a 'stylesheet_path_url' in get_bloginfo(), no? (The options in get_bloginfo() provide a roadmap of what's available; having it more complete would be nice.)
Also, does anyone find the term 'stylesheet' to be imply something less than 'child theme?' I was looking for something like 'child_template_url' and still not sure I would have thought to look for 'stylesheet_url.' Another potential addition to get_bloginfo()?
I think I'll suggest both those in trac.
On Mar 9, 2010, at 9:36 PM, Glenn Ansley wrote:
> I ran into this earlier this week and was pleasantly surprised with
> how it works. In general, I've found that template_xxx refers to
> parents and stylesheet_xxx refers to children.
>
> add_action('template_redirect','testers',1);
> function testers(){
> echo "Parent ".TEMPLATEPATH."<br />";
> echo "Child ".STYLESHEETPATH."<br />";
> echo "Child ".get_bloginfo('stylesheet_directory')."<br />";
> echo "Parent ".get_bloginfo('template_directory')."<br />";
> echo "Parent ".get_bloginfo('template_url')."<br />";
> echo "Child ".get_bloginfo('stylesheet_url')."<br />";
> }
Yes, thanks!
-Mike
More information about the wp-hackers
mailing list