Skip to content

Commit

Permalink
Update social links block to output a custom class on each ind… (#20998)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentswisher authored Mar 21, 2020
1 parent bee1bf9 commit b16542e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/block-library/src/social-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

// Don't render a link if there is no URL set.
if ( ! $url ) {
return '';
}

$icon = block_core_social_link_get_icon( $service );
return '<li class="wp-social-link wp-social-link-' . esc_attr( $service ) . '"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '"> ' . $icon . '</a></li>';
return '<li class="wp-social-link wp-social-link-' . esc_attr( $service ) . esc_attr( $class_name ) . '"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( $label ) . '"> ' . $icon . '</a></li>';
}

/**
Expand Down

0 comments on commit b16542e

Please sign in to comment.