-
Notifications
You must be signed in to change notification settings - Fork 106
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
Title check is not compatible with new title theme technique #10
Comments
Here's what I've found: This title regex check (https://github.com/Otto42/theme-check/blob/31a84b800ee709e247d4ec1e1eee59cf6849875a/checks/title.php#L45) seems to be the culprit. Looks like the reason it's failing is because of the missing tags, the quotation marks, and the semi-colon after wp_title(). I'm sure Theme Check can eventually check for add_theme_support( 'title-tag' ) if necessary, or that function can be updated, or something else. If there's anything I can do to help, let me know. Just wanted to mention this. For now, you could use the following to pass the check:
|
A check for the add_theme_support is definitely something that needs to be added for this, along with shoring up the existing title check code. |
This issue is preventing themes that support this feature from being submitted to the .org Theme Directory, FYI. |
This issue will be fixed when 4.1 is released. Themes should not support the new 4.1 features until 4.1 actually exists. |
Fixed in 0063b3b |
I've updated the backwards compat examples in the codex and in the original blog post to reflect the methodology used by _s, which will pass that particular part of theme-check. Unfortunately, short of removing this particular check entirely, there's no way for it to recognize all possible ways to output a title tag. It looks for the most common way, which is to have Theme-check does not run your code and look at the results, it's a simple scanner on the code itself. It isn't perfect, and it isn't going to be. Until we get a lot more title-tag adoption in themes, this check really needs to stick around as-is. |
@Otto42 Can you provide a link to the backwards compat example in the codex and blog post you mention please? I tried the above solutions but none of them works for me. I think I am having issues with this using 4.8 and this being the last error, all other checks pass. |
@Otto42 I found what it was! It was a, you will be laughing, |
4.1 introduces a new title-tag theme feature. For backwards compatibility, the following is recommended:
This is throwing an error with the new title checks introduced in 9a6cbcb.
Using just wp_title() in the recommended code prints immediately, instead of returning for the echo statement. This can be worked around using ob_start(), or splitting into three separate statements, but this seems like a round-about way to pass the test. Should the check be updated to allow false for wp_title()'s second attribute?
The text was updated successfully, but these errors were encountered: