-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Only display featured image UI when theme supports it too #6541
Conversation
Worth noting: I wanted to put |
That’s neat idea 👍 |
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.
Works well 👍
|
||
function PostFeaturedImageCheck( props ) { | ||
return <PostTypeSupportCheck { ...props } supportKeys="thumbnail" />; | ||
return <ThemeSupportCheck supportKeys="post-thumbnails"> |
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.
Nit (Style): My preference (and predominantly throughout the codebase) is for JSX to be placed on its own lines with parentheses if multi-lined, e.g.:
return (
<ThemeSupportCheck supportKeys="post-thumbnails">
<PostTypeSupportCheck { ...props } supportKeys="thumbnail" />
</ThemeSupportCheck>
);
If it's a convention we want to adopt, we could enforce with:
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.
My preference (and predominantly throughout the codebase) is for JSX to be placed on its own lines with parentheses if multi-lined, e.g.:
Seems reasonable to me 1916026
Description
Ensures the "Featured Image" UI only displays when the theme supports
post-thumbnails
too.Fixes #2523
Previously #6510
Types of changes
My code introduces a new
ThemeSupportCheck
component to inspect the theme'spost-thumbnails
setting. If the theme doesn't support post thumbnails, then the featured image UI doesn't render.The code also introduces
post-thumbnails=true
on the site index for exposure through the REST API.Checklist:
How has this been tested?
Using Twenty Seventeen, here's the UI that normally displays:
Then, add the following code snippet to a
wp-content/mu-plugins/local.php
file:The "Featured Image" will no longer display: