-
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
Categories List Block: Match the markup on the block editor to the front end #43666
Conversation
Size Change: +56 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
Wish: To be able to style the post count, the span and the class name that was used in the editor should be added to the front instead of removed from the editor. |
Thanks for your input! So this might be something to consider in the WordPress core. Also, there is |
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.
I have tested the PR, and I have not found any issues. Moving the class wp-block-categories-dropdown
from the select
to the wrapping div is an improvement.
I found one plugin in the plugin directory that styles this class:
https://wpdirectory.net/search/01GCGP40C3JA2F62XNK7G0VQTV
There are 251 themes in the theme directory that styles this class, but I did not dig deep enough to see if it was an editor style or front end style:
https://wpdirectory.net/search/01GCGP7P7R5R9YFQ98S4VGA0GY
I would consider the change low risk.
@carolinan
Therefore, I would like to merge this PR as is. |
Fix: #42984
What?
This PR makes the markup on the block editor the same as on the front editor in order to keep the markup consistent.
Why?
If class names and makups are different between the editor and the front end, it will be difficult to use a common selector for styling.
Also, I could not find any reason for different markup on the editor.
How?
In order to get closer to the frontend markup, I have taken the following actions:
ul
tag).wp-block-categories__list
,.wp-block-categories__list-level-{level}
,.wp-block-categories__post-count
,.wp-block-categories__dropdown
)li.cat-item,cat-item-{id}
,option.level-{level}
)Testing Instructions
Screenshots or screencast
Below is a comparison of the block editor and front-end markup for one variation.
Frontend
Block Editor