Updated the example file with examples for different include situations.#503
Updated the example file with examples for different include situations.#503
Conversation
9278a6d to
c981b5d
Compare
There was a problem hiding this comment.
No need for this - parent themes can call get_stylesheet_directory() too, since template dir = stylesheet dir in parent themes.
There was a problem hiding this comment.
True, however, not applicable in this case.
If no child theme is being loaded, the get_stylesheet_directory() would be fine as WP will detect that there is no child theme and return the parent theme directory.
If a parent theme uses TGMPA and a child theme of that parent is the loaded theme, things would go very wrong with the include call. This is not a url/path which is being passed to a get_template_part() call, after all, but a hard file include.
To demonstrate, take this example set up:
/wp-content/themes/
- /parent-theme
- /vendor/tgmpa/tgm-plugin-activation.php
- /child-theme
- does not include tgmpa
The get_template_directory() function would return /path/to/wp-content/themes/parent-theme.
The get_stylesheet_directory() function would return /path/to/wp-content/themes/child-theme.
If the parent theme would include the file using get_stylesheet_directory(), this would result in a fatal file not found error.
Updated the example file with examples for different include situations.
Fixes #469.