Last active
September 20, 2021 10:35
-
-
Save em-piguet/dfc7e08f50b4da99f1e57d00c5874499 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 | |
/* | |
* ADD OEMBED TO RTS.CH | |
* Copied from : https://gist.github.com/marcwieland95/61074b488aae12460a17882aeb3e0fd8 | |
*/ | |
wp_embed_register_handler('srg', '#https?:\/\/(?:www\.)?(srf|rsi|rts|rtr)\.ch\/.*(?:detail\/|video:)((?:.{8}-.{4}-.{4}-.{4}-.{12})|\d*)(?:.startTime=(\d*)|.*)#i', function ($matches, $attr, $url, $rawattr) { | |
return sprintf( | |
'<div class="embed-container"><iframe width="560" height="315" src="https://%1$s.ch/play/embed?urn=urn:%1$s:video:%2$s" allowfullscreen allow="encrypted-media"></iframe></div>', | |
esc_attr($matches[1]), | |
esc_attr($matches[2]), | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment