Reputation: 13
I am using framework for develop theme for wordpress. after install framework i create child theme and include files from my framework in functions.php.
In 2 other projects all works fine, but in my new project i have an error. When i call TEMPLATEPATH it back absolute path to child directory, but it must return a path to parent theme.
What can be wrong?
P.S. Framework use TEMPLATEPATH to include his own files, so i need to understand how can i fix this problem.
Upvotes: 0
Views: 1444
Reputation: 2710
This happened to me because I created my child theme first and had it activated BEFORE creating my parent themes style.css file.
All you have to do to fix this is Activate any other theme, then reactivate your child theme. This will correct the 'template' value in the wp_options table.
Upvotes: 0
Reputation: 13
I found solution of my problem.
I got wrong path to parent theme because in DB in table "wp_options" in field "template" was a child theme name. When i changed value of this field to parent theme name, the TEMPLATEPATH start return a path to parent theme.
Upvotes: 1
Reputation: 4503
You should try using get_template_directory_uri()
to get the parent theme directory like so:
echo get_template_directory_uri()/img/icon.png
If you want to get something out of your child theme directory you can use get_stylesheet_directory_uri()
.
More info:
Edit: Just noticed McNab's reply in the comments of the question, give this guy some upvotes as well. :)
Upvotes: 1