Created
March 28, 2019 22:50
-
-
Save ngm/868e7ae1617fd41a185eddc4599681f0 to your computer and use it in GitHub Desktop.
Wordpress embed handler for invidio.us
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
wp_embed_register_handler( 'invidious_watch', '#https?://invidio\.us/watch\?v=([A-Za-z0-9\-_]+)#i', 'wp_embed_handler_invidious' ); | |
wp_embed_register_handler( 'invidious_embed', '#https?://invidio\.us/embed/([A-Za-z0-9\-_]+)#i', 'wp_embed_handler_invidious' ); | |
function wp_embed_handler_invidious( $matches, $attr, $url, $rawattr ) { | |
$embed = sprintf( | |
'<iframe src="https://invidio.us/embed/%1$s" frameborder="0" scrolling="no" marginwidth="0" marginheight="0" width="600" height="400"></iframe>', | |
esc_attr($matches[1]) | |
); | |
return $embed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment