Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By kmillecam on
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
That might be the best it can do
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.
I was hoping that the path_to_theme() function
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.
$theme_key works
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:
Kevin
http://www.webwiseone.com
It's all about community.
https://bkjdigital.com
We make magic.