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 | |
/** | |
* Remove the autoemed functionality in WordPres | |
* | |
* By using this filter, URLs from Youtube, Twitter etc. won't transform into embeded contents | |
**/ | |
add_action( 'init', 'fwe_remove_auto_embed' ); | |
function fwe_remove_auto_embed(){ | |
remove_filter( |
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 | |
/** | |
* This script adds Github Gist to the registered oEmbed providers in WordPress | |
**/ | |
wp_embed_register_handler( 'gist', '/https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/i', 'wp_embed_handler_gist' ); | |
function wp_embed_handler_gist( $matches, $attr, $url, $rawattr ) { | |
$embed = sprintf( | |
'<script src="https://gist.github.com/%1$s/%2$s.js"></script>', | |
esc_attr($matches[1]), | |
esc_attr($matches[2]) |
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 Gfycat as oEmbed provider | |
**/ | |
wp_oembed_add_provider( | |
'#http(s)?://(www\.)?gfycat\.com/.*#i', | |
'https://api.gfycat.com/v1/oembed?url=', | |
true | |
); | |
?> |
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 | |
/** | |
* If you have already included Gist as a handler, you could | |
* use this Snippet to include the raw output as iframe... | |
* ... if... well if github would permit it... but | |
* just for demonstration purposes. | |
* **/ | |
add_filter( 'embed_handler_html', 'fwe_embed_handler_html', 10, 4 ); | |
function fwe_embed_handler_html( $html, $url, $attr, $post_ID = null ){ |
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_filter( 'oembed_result', 'fwe_oembed_result', 10, 3 ); | |
function fwe_oembed_result( $result, $url, $args ){ | |
//Uebernommen aus wp-includes/class-oembed.php | |
//L38ff | |
$youtube_regex = array( | |
'#http://((m|www)\.)?youtube\.com/watch.*#i', | |
'#https://((m|www)\.)?youtube\.com/watch.*#i', | |
'#http://youtu\.be/.*#i', | |
'#https://youtu\.be/.*#i', |
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
jQuery( document ).ready( function(){ | |
jQuery( '.youtube-wrapper img' ).click( function(){ | |
var id = jQuery( this ).parent().attr( 'data-youtube' ); | |
var html = '<iframe width="480" height="270" src="https://www.youtube.com/embed/' + id + '?feature=oembed" frameborder="0" allowfullscreen></iframe>'; | |
jQuery( this ).parent().html( html ); | |
}); | |
}); |
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_filter( 'oembed_dataparse', 'fwe_oembed_dataparse', 10, 3 ); | |
function fwe_oembed_dataparse( $result, $data, $url ){ | |
//Uebernommen aus wp-includes/class-oembed.php | |
//L38ff | |
$youtube_regex = array( | |
'#http://((m|www)\.)?youtube\.com/watch.*#i', | |
'#https://((m|www)\.)?youtube\.com/watch.*#i', | |
'#http://youtu\.be/.*#i', | |
'#https://youtu\.be/.*#i', |
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_filter( 'oembed_response_data', 'fwe_oembed_response_data', 11, 4 ); | |
function fwe_oembed_response_data( $data, $post, $width, $height ){ | |
if ( ! is_object( $post ) ) | |
return $data; | |
if( ! has_post_thumbnail( $post->ID ) ) | |
return $data; | |
$thumbnail_id = get_post_thumbnail_id( $post->ID ); | |
$image = wp_get_attachment_image_src( $thumbnail_id, 'full' ); |
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 | |
/** | |
* Contains the post embed template. | |
* | |
* When a post is embedded in an iframe, this file is used to | |
* create the output. | |
* | |
* @package WordPress | |
* @subpackage oEmbed | |
* @since 4.4.0 |
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 | |
/** | |
* Contains the post embed content template part. | |
* | |
* When a post is embedded in an iframe, this file is used to | |
* create the content template part output if the active theme does not include | |
* a content-embed.php template. | |
* | |
* @package WordPress | |
* @subpackage Theme_Compat |
OlderNewer