Created
December 25, 2012 11:55
-
-
Save remkus/4372844 to your computer and use it in GitHub Desktop.
Flexible oEmbed
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( '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