Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created March 3, 2012 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpsmith/1964381 to your computer and use it in GitHub Desktop.
Save wpsmith/1964381 to your computer and use it in GitHub Desktop.
Changes the default embed sizes based on conditionals
add_filter( 'embed_defaults', 'wps_embed_defaults' );
/**
* Changes the default embed sizes based on site layout
* @author Travis Smith
*
* @param array height and width keys, values can be string/int
* @return array height and width keys and values
*/
function wps_embed_defaults( $defaults ) {
if ( is_home() || is_category() )
return array( 'width' => 600, 'height' => 400 );
else
return $defaults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment