Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-includes/css/wp-embed-template.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ p.wp-embed-heading {

.wp-embed-share-dialog-open:focus .dashicons,
.wp-embed-share-dialog-close:focus .dashicons {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus, 1.5px) var(--wp-admin-theme-color, #3858e9);
box-shadow: 0 0 0 1.5px #3858e9;
/* Only visible in Windows High Contrast mode */
outline: 2px solid transparent;
border-radius: 100%;
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -1233,8 +1233,8 @@ function the_embed_site_title() {
$site_title = sprintf(
'<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon" /><span>%s</span></a>',
esc_url( home_url() ),
esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ),
esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ),
esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-gray-white-bg.svg' ) ) ),
esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-gray-white-bg.svg' ) ) ),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second instance with the srcset can be eliminated since it is an SVG, right? It's a vector. Or is the reason for the sake of the image being overridden by filters in which case it could be non-vector?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that most site icons are PNG; the WordPress logo is merely a fallback.

However, the image file is likely often the same for both the 32 and 64 sizes. Maybe it could check whether they match before adding a srcset attribute.

	$site_icon_32 = get_site_icon_url( 32, includes_url( 'images/gray-white-bg.svg' ) );
	$site_icon_64 = get_site_icon_url( 64, includes_url( 'images/gray-white-bg.svg' ) );

	$site_title = sprintf(
		'<a href="%s" target="_top"><img src="%s"%s width="32" height="32" alt="" class="wp-embed-site-icon" /><span>%s</span></a>',
		esc_url( home_url() ),
		esc_url( $site_icon_32 ),
		( $site_icon_32 !== $site_icon_64 ) ? ' srcset="' . esc_url( $site_icon_64 ) . ' 2x"' : '',
		esc_html( get_bloginfo( 'name' ) )
	);

Theoretically someone could use the filter to edit the output, expecting srcset in a str_replace or preg_replace function. On the other hand, Veloria searches only found 4 plugins that add the 'embed_site_title_html' hook:

  • WPSSO Core does not modify the output.
  • TotalPoll and Photo Contest (by the same author) both return an empty string.
  • Embed Your Posts replaces the output entirely.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR 11601 touches the same function, and it should be completed first. I suggested a code change on that PR for the case when both image URLs match.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that it may be a PNG or an SVG, it's probably safer to just leave the srcset. It will probably just be duplicating the SVG URL with the src, but that won't hurt anything. So I retract my suggestion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, but if the URLs don't match, then it would make sense in that case.

esc_html( get_bloginfo( 'name' ) )
);

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ function do_favicon() {
*/
do_action( 'do_faviconico' );

wp_redirect( get_site_icon_url( 32, includes_url( 'images/w-logo-blue-white-bg.png' ) ) );
wp_redirect( get_site_icon_url( 32, includes_url( 'images/w-logo-gray-white-bg.png' ) ) );
exit;
}

Expand Down
Binary file added src/wp-includes/images/w-logo-gray-white-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/wp-includes/images/w-logo-gray-white-bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading