[wp-hackers] bloginfo('template_directory'); returns parent theme's directory, is this intended?

Peter Westwood peter.westwood at ftwr.co.uk
Mon Jan 10 18:22:47 UTC 2011


On 10 Jan 2011, at 13:17, Ryan Bilesky wrote:

> I am wanting to make several tweaks to a theme for my use, and I've chose to
> do so by making a child theme to be upgrade safe.  However I noticed that I
> changed some colors around on my child themes css but I was not seeing the
> change.  So I viewed source of my site and saw that it was using the parent
> theme's css file.  In the header.php this was the code:
> 
> <link rel="stylesheet" type="text/css" href="<?php
> bloginfo('template_directory'); ?>/style.css" />
> I fixed this by adding a modified version of header.php in my child themes
> directory that has the css url hard coded.  So my question is this, is
> bloginfo('template_directory'); supposed to return the parent theme or child
> theme directory when called?
> 

This is working correctly.

The "Template" is the Parent Theme
The "Stylesheet" is the Child Theme

So for the child theme you want 'stylesheet_directory'

Ideally though you wouldn't be using bloginfo at all and rather:

get_stylesheet_directory_uri / get_template_directory_uri

Cheers
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5



More information about the wp-hackers mailing list