Skip to content

Updated the example file with examples for different include situations.#503

Merged
GaryJones merged 1 commit intodevelopfrom
feature/issue-469
Jan 5, 2016
Merged

Updated the example file with examples for different include situations.#503
GaryJones merged 1 commit intodevelopfrom
feature/issue-469

Conversation

@jrfnl
Copy link
Copy Markdown
Contributor

@jrfnl jrfnl commented Jan 4, 2016

Fixes #469.

@jrfnl jrfnl assigned jrfnl and GaryJones and unassigned jrfnl Jan 4, 2016
@jrfnl jrfnl force-pushed the feature/issue-469 branch from 9278a6d to c981b5d Compare January 4, 2016 13:58
@GaryJones GaryJones added this to the 2.6.0 milestone Jan 5, 2016
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this - parent themes can call get_stylesheet_directory() too, since template dir = stylesheet dir in parent themes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

GaryJones added a commit that referenced this pull request Jan 5, 2016
Updated the example file with examples for different include situations.
@GaryJones GaryJones merged commit 01212ae into develop Jan 5, 2016
@GaryJones GaryJones deleted the feature/issue-469 branch January 5, 2016 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants