-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the example 'source' path to work with child themes #678
base: develop
Are you sure you want to change the base?
Conversation
Hi @kevinvess Thanks for your PR. I get where you are coming from, and this is handled by the Custom TGMPA Generator which is the recommended way to download TGMPA. |
@kevinvess Did my response clarify things ? can I close the PR ? |
Thanks for the response; I do see the Custom Generator does handle applying the correct function depending on how the user intends to use this library. However, I still think my PR is worth merging. Its a small change that will help ensure that anyone who copies this library from GitHub instead of using your Custom Generator will not run into issues when adding a child-theme later – as is what happened to me. Do what you will with this, its your code repository. |
@jrfnl From your previous stats, do you have any indication about whether TGMPA is included more with parent or child themes? |
@GaryJones I don't currently have those kind of stats, just theme vs plugin and # per version of TGMPA. There is a sniff proposal is the TRT fork of the WordPress Coding Standards which looks for TGMPA and does some checks. I could add some metrics to that sniff and run it over the theme repo. That should give some indication, though only of the themes published on WP.org - which isn't really all that relevant as themes published on WP.org have to use a version generated using the Custom TGMPA Generator. Running the sniff over the theme repo will probably take a couple of hours (aside from having to sync the theme repo again first), so it may be a little while before I could have figures. |
I consider this to be minor, so if it doesn't get addressed until a later release, so be it. |
Ok, I've ran the metrics for the whole theme repository and posted the results in the sniff thread: WPTT/WPThemeReview#132 (comment) I have to reiterate that these results are not all that relevant as they are based on the WP.org theme repo where themes are required to use the Custom Generator anyway. While the results lean towards TGMPA being included more with parent themes than child themes (not surprisingly), the results are not conclusive as the child/parent theme status is unknown of 43% of the themes using TGMPA (= themes using outdated versions and themes using a TGMPA version not generated using the Custom TGMPA Generator, mostly because they were published before it was available). Thinking this over, these are the potential usage combinations I can think of and whether either function would work out of the box, where the third option is probably least in use:
If my thinking here is correct (and please verify for yourselves), then based on this table, there is sufficient justification for making this change. If it would be so decided, however, this PR will need a sister-PR to adjust the logic in the Custom TGMPA Generator before this can be merged. |
Thank you for the investigation and write-up.
Let's do it :-) |
OK, so open actions:
|
By using the get_template_directory() function, it retrieves the absolute path to the directory of the current theme; and if a child theme is being used, the absolute path to the parent theme directory will be returned.
I think it makes more sense to use this method in the example script in case theme developers are just copying this without testing if it works for child themes. I would imagine this gets used for more parent themes than child themes anyway.