-
Notifications
You must be signed in to change notification settings - Fork 37
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
File name with reserved slug in subfolder #233
Comments
This is odd, as there is a list of allowed folders in the ruleset So this should work out of the box if I'm not mistaken 🤔 Unless this needs to be re-set in the custom ruleset 🤷♂ Any info on this @jrfnl ? |
Oh, I did not know we had such exclusion. |
It should work out of the box. Based on the remark by @joyously in WordPress/twentytwenty#111 (comment), I wonder if all templates files in subdirectories should be excluded ? Note: this may not be feasible to do as PHPCS does not natively know what the root directory of a project is (and the sniff(s) may not be run from the root). |
Looks like the subdirectory in TwentyTwenty is called <rule ref="WPThemeReview.CoreFunctionality.PrefixAllGlobals">
<properties>
<property name="allowed_folders" type="array" extend="true">
<element value="parts"/>
</property>
</properties>
</rule> |
I'll mention this to the twenty twenty team. Maybe they can just follow the standard practices and use |
I just noticed that it's not 1 | ERROR | [ ] Template files should not be slug specific. The
| | file name used for this template will be
| | interpreted by WP as page-header and only applied
| | when a page with the slug "header" is loaded. Should we add the same property to this sniff as well? |
@dingo-d Sounds like a good idea, but beware of what I said in #233 (comment) |
I guess this can be closed. |
Oh, I'd leave this open, because this is an issue with the sniff, we just need to be smart around how to attack this problem (given the comment that Juliette mentioned). |
@jrfnl Could we use |
Follow up of #212 (Check if page templates are using reserved prefix)
This check generates error for file in subfolder also, like
template-parts/page-header.php
. When such file is within the subfolder other than root, there wont be any effect in the hierarchy. It would be great if can apply this check in root folder only.The text was updated successfully, but these errors were encountered: