-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Featured Image: Use the first image in the post #51603
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scruffian
added
[Type] Feature
New feature to highlight in changelogs.
[Block] Post Featured Image
Affects the Post Featured Image Block
labels
Jun 16, 2023
Size Change: +63 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
Flaky tests detected in 22697dd. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5293620799
|
This was done in #56573 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Block] Post Featured Image
Affects the Post Featured Image Block
[Type] Feature
New feature to highlight in changelogs.
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.
What?
This adds a toggle to the featured image block to allow the featured image block to fallback to the first image in the post.
Why?
This is particularly useful for people replacing classic themes with block themes. Many old posts don't have featured images, and it's a lot of work to go back to them and add them all. This allows theme builders to use the post featured image block in a query block and have more confidence that an image will show.
How?
We use parse blocks to grab the ID of the first image block and then apply a filter to the post featured image to return that id.
Testing Instructions
Use first image from post if no featured image set
Testing Instructions for Keyboard
As above
Screenshots or screencast
TBD
Todo:
This works fine in the frontend but not in the editor.