Created
April 19, 2019 15:42
-
-
Save johnss/a2e82b49b0fc80224adbfb616b57436c to your computer and use it in GitHub Desktop.
Wordpress Embed Add Openload
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 | |
function wp_embed_handler_openload($matches, $attr, $url, $rawattr) | |
{ | |
$embed = sprintf( | |
'<iframe src="https://openload.co/embed/%s" scrolling="no" frameborder="0" width="700" height="430" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true">></iframe>', | |
esc_attr($matches[1]) | |
); | |
return apply_filters('embed_openload', $embed, $matches, $attr, $url, $rawattr); | |
} |
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_action('init', function() | |
{ | |
wp_embed_register_handler( | |
'openload', | |
'#https://www\.openload\.co/f/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_.-]+)?#i', | |
'wp_embed_handler_openload' | |
); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment