-
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
Update social links block to output a custom class on each individual link #20998
Conversation
Size Change: 0 B Total Size: 856 kB ℹ️ View Unchanged
|
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.
LGTM 👍
Thank you for this fix!
@@ -19,14 +19,15 @@ function render_block_core_social_link( $attributes ) { | |||
$attributes['label'] : | |||
/* translators: %s: Social Link service name */ | |||
sprintf( __( 'Link to %s' ), block_core_social_link_get_name( $service ) ); | |||
$class_name = ( isset( $attributes['className'] ) ) ? ' ' . $attributes['className'] : false; |
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 seems we can remove the external parentheses ( isset( $attributes['className'] ) )
right?
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.
Yeah no problem, that was just how the rest of the ternary assignments were written for the other attributes in the function so I thought it might be a WordPress coding convention, I can update
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's been updated to remove the external parentheses
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.
Sorry did not notice the other attributes also had parentheses, anyway I think they are not required so thank you for the update 👍
…n the individual social link items
8754ef3
to
811c6e3
Compare
Description
Fixed #19335 by updating
render_block_core_social_link()
to append a custom class to each<li>
if one is present.How has this been tested?
<li>
has your custom class appended.Screenshots
Add a custom class 'CUSTOM' to the individual link
Add a custom class 'Banana' to the entire block
See that they both render correctly on the public side
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: