This code is used to get the directory of the current plugin: plugin_dir_url( __FILE__ ).
What should I use to get the directory of the current theme?
|
This code is used to get the directory of the current plugin: What should I use to get the directory of the current theme? |
|||
|
|
|
I think you have to be a little careful because it depends on what you are trying to do. If you are using a child theme get_template_directory(); will still go to the parent theme. However get_stylesheet_directory(); will go to the current theme, child or parent. Also, both these functions return absolute server paths. If you wanted a fully formed URI, for links or images, you should use get_template_directory_uri(); or get_stylesheet_directory_uri(); using the correct one for the reasons stated. Summary
|
|||||
|
http://codex.wordpress.org/Function_Reference/get_template_directory |
|||
|
|