Skip to content
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

Like default theme use get_theme_file_uri function instead of get_template_directory_uri #1141

Open
vinoddalvi opened this issue Jun 28, 2017 · 11 comments

Comments

@vinoddalvi
Copy link
Contributor

Use newly introduced function get_theme_file_uri that makes it easy to overwrite files in child theme. The Twenty Seventeen theme already uses this function.

@m-e-h
Copy link

m-e-h commented Jun 28, 2017

Wouldn't get_parent_theme_file_uri be more appropriate here?
If there's a child theme, get_theme_file_uri would first look there for /js/customizer.js and use that instead. I could see this causing problems.
I don't see a child theme wanting to override these scripts unless it's unintentional.

@samikeijonen
Copy link
Contributor

Before we started using new functions 2 major version back if I remember correctly. That means that those functions can be used in version 4.9 because they arrived in 4.7.

@davidakennedy
Copy link
Contributor

I dropped some similar comments to @samikeijonen on the PR since I saw that first.

@samikeijonen
Copy link
Contributor

We can proceed this now.

@davidakennedy
Copy link
Contributor

I second that we can proceed here. PRs welcome, if one of the maintainers doesn't get to it first.

@jrfnl
Copy link
Contributor

jrfnl commented Feb 27, 2018

Note for whoever creates the PR for this:
Please don't forget to update the Requires at least WP version in the readme.txt and the same in the phpcs.xml.dist file.

@m-e-h
Copy link

m-e-h commented Feb 27, 2018

To clarify, is get_parent_theme_file_uri what we want here rather than get_theme_file_uri?

@samikeijonen
Copy link
Contributor

get_theme_file_uri for assets because the idea is that child themes can actually overwrite assets files. And perhaps get_parent_theme_file_path for requiring files in inc folder at the same time.

@m-e-h
Copy link

m-e-h commented Feb 28, 2018

I was actually thinking the opposite. 😯

Asset files can easily be dequeued.
Like I mentioned above, I have several child themes with a /js/customizer.js or something like a /js/main.js file in them. I wouldn't want or expect that to override the the parent themes js.

@samikeijonen
Copy link
Contributor

That's only my opinion because for novice site owners that's the easier way, talking only about public themes here.

@wpexplorer
Copy link

I agree with m-e-h using get_parent_theme_file_path and get_parent_theme_file_uri would be the ideal functions to use. Many people like to use the same names for scripts/files in their child themes (no matter what the parent theme is) without having to look into the parent to see if it will create a conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants