-
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
Add cite to theme.json elements #42851
Conversation
Size Change: +148 B (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
When I add the code example above to theme.json, the styles are still being overwritten, perhaps by the current core styles?
|
Thanks for working on this @carolinan. What do you think about making the core rules less specific (probably using :where) so that the theme.json rules can take precedence when they are set?) |
The changes to the stylesheets will override the core styles when it is merged into core, no? They already use |
@@ -96,11 +96,13 @@ class WP_Theme_JSON_6_1 extends WP_Theme_JSON_6_0 { | |||
'h6' => 'h6', | |||
'button' => '.wp-element-button, .wp-block-button__link', // We have the .wp-block-button__link class so that this will target older buttons that have been serialized. | |||
'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', // The block classes are necessary to target older content that won't use the new class names. | |||
'cite' => '.wp-element-cite, .wp-block-quote cite, .wp-block-quote__citation, .wp-block-pullquote cite, .wp-block-pullquote__citation', |
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.
Are there cases when we don't want to style the cite
element? I'm just wondering if we can simplify this to be just cite
?
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.
It started out as only cite 😄 but then I read through the previous 'elements' pull requests and I thought the class names were added to make it easier for developers.
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.
The class names are necessary if we expect there to be situations where we do NOT want elements to pick up this style - Buttons is a good example - there might be button elements which we don't want to style as buttons, and link elements which we do want to appear as buttons. Links on the other hand should always use the link style rules, so we use a much simpler selector. If we can use a cite
selector here it will make things much simpler. The only reason I can think of not doing that is if there are blocks that might use cite
but don't want these styles, but I can't think of a case when that would be true.
Ah sorry I missed that. |
What?
Adds cite to theme.json elements. Partial for #35735.
Why?
To make it possible to style quote and pull quote citations separately.
How?
The PR adds cite to theme.json elements and adds the new CSS class
wp-element-cite
.I am not sure if I updated the fixtures and tests correctly.
Testing Instructions
Add the following to theme.json:
In either editor, add a quote block and a pullquote block.
Confirm that the styles applies correctly in the editors and front.
Screenshots or screencast