-
-
Save 2aces/b5ad64cf0d273a8bcf9f to your computer and use it in GitHub Desktop.
forces CDN subdomain for srcset file list on img element
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
// you MUST change static1 to your CDN subdomain as needed | |
function aafd_cdn_srcset($sources){ | |
foreach ( $sources as $source ) { | |
$sources[ $source['value'] ][ 'url' ] = str_replace('http://www', 'https://static1', $sources[ $source['value'] ][ 'url' ]); | |
// you MAY use external domains as well | |
// $sources[ $source['value'] ][ 'url' ] = str_replace('http://www.example.com', 'https://static.examplecdnprovider.com', $sources[ $source['value'] ][ 'url' ]); | |
} | |
return $sources; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment