Skip to content

Instantly share code, notes, and snippets.

@em-piguet
Last active September 20, 2021 10:35
Show Gist options
  • Save em-piguet/dfc7e08f50b4da99f1e57d00c5874499 to your computer and use it in GitHub Desktop.
Save em-piguet/dfc7e08f50b4da99f1e57d00c5874499 to your computer and use it in GitHub Desktop.
<?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