Hi,

I'm trying to leverage the path_to_theme() function but it's not working as advertised.

I've added this to my page.tpl.php file:

    print path_to_theme();

But the problem is that it returns the *parent* theme not he child theme that I have enabled.

For example, I added the above snippet to the Minelli theme and the path I'm getting back is "/themes/garland"

Am I doing something wrong?

TIA,

Kevin

Comments

Anonymous’s picture

Because Minelli is not a full theme. That is, it doesn't have it's own tpl files etc. In fact, Minelli is just a different style sheet applied to Garland. I don't know for sure that this is the cause of you problem, but I suspect it is.

kmillecam’s picture

Hmmm,

Not really the answer I was looking for.

I was hoping that the path_to_theme() function returned the literal path to a theme, regardless of whether it's a "full" theme or a theme defined by CSS.

Does anyone have an answer that's more to my liking or do I have to stick with the one already given?

Thanks,
Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

kmillecam’s picture

Instead of using path_to_theme(), I've changed my code to use $theme_key.

It does return the name of the current theme regardless of it's location in the theme directory hierarchy.

FYI, here's the code I'm using to pull a specific file into my page.tpl.php file depending on what theme is being used:

  global $theme_key; 
  $include_file = $theme_key . '.inc';
  include($include_file);

Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.