Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[Reader Mode] Add theme support features from
theme.json
#7481[Reader Mode] Add theme support features from
theme.json
#7481Changes from 7 commits
2a3d437
5f5d914
0083e8c
5e141a9
7b4560c
1fc0531
4ce8f09
8702afe
1608869
2451c92
e6ff86e
ce11732
7487201
0c604ba
3cc3845
f1d16af
d319244
722476c
1f86856
ca4d199
bcb0081
6de102d
910ee2f
72af542
5723c78
7696b82
9f690e4
bf09356
7fa8769
d03e179
1b2e100
7996b3a
dda1105
9e5783d
2ac115a
4affefd
8ed814d
21f12f2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would seem simpler as:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I suggest using
wp_theme_has_theme_json()
if it exists, or else copy the function as a method into this class:https://github.com/WordPress/wordpress-develop/blob/200868214a1ae0a108dac491677ba82e7541fc8d/src/wp-includes/global-styles-and-settings.php#L384-L414
Note how it caches the file exists check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes. Bette to copy it since we will need to check for theme.json on WP 5.9+ and this function is added in WP 6.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor point, but I don't think
esc_attr()
is right here. I thinkstrip_tags()
is the right choice. See https://github.com/WordPress/wordpress-develop/blob/200868214a1ae0a108dac491677ba82e7541fc8d/src/wp-includes/theme.php#L1891-L1896There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does make sense, but I am not sure if we will ever get tags here. Or better to never assume and update it to use
strip_tags()
🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to never assume, yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realized, we will still need the escaping, as
strip_tags
is not an escaping utility.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is somewhat. It's what core uses in
wp_custom_css_cb()
.