Last active
December 8, 2020 17:33
-
-
Save georgestephanis/9a6fec3a4043f75c33862a2b281f4f69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// loosely based on a selector from https://davidwalsh.name/external-links-css | |
wp_add_inline_style( | |
'mytheme-style', | |
sprintf( | |
'a[href*="//"]:not([href*="%1$s"]) { | |
padding-%3$s: 17px; | |
background: url("%2$s") center %3$s no-repeat; | |
background-size: 13px; | |
}', | |
esc_attr( wp_parse_url( get_site_url(), PHP_URL_HOST ) ), | |
esc_url( get_theme_file_uri( 'assets/img/external-link.svg' ) ), | |
( is_rtl() ? 'left' : 'right' ) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment