Created
August 26, 2015 12:22
-
-
Save iparamonau/64bf07527d66ec0b9cff to your computer and use it in GitHub Desktop.
WordPress: wrap embed HTML with the domain specific class
This file contains hidden or 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
| add_filter( 'embed_oembed_html', 'domain_class_oembed_filter', 10, 2) ; | |
| function domain_class_oembed_filter($html, $url) { | |
| $domain = preg_replace( '#www\.|\.com#i', '', parse_url($url, PHP_URL_HOST)); | |
| return '<div class="iframely '.$domain.'">'.$html.'</div>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the full hostname and a sub-class for more harderer code.