Skip to content

Instantly share code, notes, and snippets.

@remkus
Created December 25, 2012 11:55
Show Gist options
  • Save remkus/4372844 to your computer and use it in GitHub Desktop.
Save remkus/4372844 to your computer and use it in GitHub Desktop.
Flexible oEmbed
<?php
add_filter( 'embed_defaults', 'custom_oembed_defaults' );
/**
* Custom WordPress oEmbed widths
* @param var $embed_size
* @return var
*/
function custom_oembed_defaults( $embed_size ) {
// use any WordPress conditional here
if( is_front_page() ) {
$embed_size['width'] = 940;
$embed_size['height'] = 600;
}
// define the default one
else {
$embed_size['width'] = 666;
$embed_size['height'] = 333;
}
return $embed_size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment