loganfordwd / Hi-Yield-Coding-Challenge

This is a repo on the Hi-Yield 'coding challenge'
0 stars 0 forks source link

Use get_theme_file_uri and get_theme_file_path when enqueuing #2

Open 1sd15 opened 2 years ago

1sd15 commented 2 years ago

Hey Logan; it's Justin here!

I think you should look at using get_theme_file_uri() and get_theme_file_path() instead of get_template_directory().

We use those two functions here at HY instead of get_template_directory_uri() and `get_template_directory() as they will check the current theme for a file; then check the parent theme.

Some more advanced sites may have themes that inherit from other themes; so we use the first two functions to make sure it functions how we want.

https://developer.wordpress.org/reference/functions/get_theme_file_uri/ https://developer.wordpress.org/reference/functions/get_theme_file_path/

https://github.com/loganfordwd/Hi-Yield-Coding-Challenge/blob/513ad5f3ccde5bb3a9350a37152f44716e98c21c/NOT-CHALLENGE-EXPANDING-ON-WORDPRESS/wp-content/themes/HiYield_Theme/functions.php#L6

loganfordwd commented 2 years ago

Hey Justin!

Thank you for sharing those links they were a useful read!

I'm going to be focusing on my wordpress knowledge over the next few weeks so if you have any other sites/links you think I will find useful it would be greatly appreciated if you could send them my way!