-
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
Post Excerpt: Displays the post type name as preview in the editor #48964
Comments
How about 'This is the Post Excerpt block, it will display the excerpt.' The block description is still 'Display a post's excerpt.' though. |
Digging into the repo, I found this issue #44322. I did some explorations in the code, but it isn't possible to retrieve the post type in the block. Even if the block has:
templates don't inject the data into the context. |
Yes, correct, the post type is in a different package. This is not the only time we need a post type in a block, I don't know how to fix it though. |
@carolinan Thanks for the feedback! I opened a PR with another approach! Let me know what you think! |
@carolinan I created a PR to improve the preview #50167 Also, I created a tracking issue to keep track of all core blocks that could have a better preview using the post type of the template #49108 |
One difficulty with solving this is how to retain allowance in layouts for use cases where multiple post types might be in the layout. That consideration potentially eliminates some of the more obvious solutions (i.e. just use template or block context). There is also the issue of discoverability. When users are looking for a block related to a specific post type (such as "movies" or "products"), how will they know that "Post Title", "Post Excerpt" or even "Query Loop" blocks are available for those post types (not to mention the average user might not even know or care that "movie" or "product" are post types)? I can think of a few ways to handle this (as ideas):
|
Hey @nerrad, thanks for your feedback!
I implemented this suggestion (0e8f4038068428de8106222f336299765afdf4a0) by taking inspiration from the core/post-terms block (source code). The downside is that the block will always be visible in the inserter (like the post terms block): Also, another downside, I added a new attribute to determine which is the active variation (source code). What do you think? |
What problem does this address?
Currently, in the editor, the preview of the Post Excerpt is hard coded and it is:
The preview is clear for advanced users, but it could create some confusion for newcomers.
A better preview could be:
For instance, in the image below, I'm editing the Single Template for the post type
Movie
. The Post Excerpt Block should show:I created a similar issue for the Post Title block #48963
The text was updated successfully, but these errors were encountered: