D
D
dron1122020-08-06 12:12:20
WordPress
dron112, 2020-08-06 12:12:20

What is the difference between get_template_directory_uri() and get_template_directory?

Tell me, in simple and understandable words, what is the difference between these two functions, preferably with examples?

As I understand it:
1) get_template_directory - this function returns the path from the root to the theme
2) get_template_directory_uri() - returns the URL of the parent theme (read on wp-kama, but what is the parent theme?). You can also temporarily connect pictures with this function.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Chesnokov, 2020-08-06
@cesnokov

get_template_directory() - returns the path in the file system, for example:

/home/admin/web/habr.com/public_html/wp-content/themes/theme

get_template_directory_uri() - returns the address, for example:
http://habr.com/wp-content/themes/theme

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question