Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created March 3, 2012 04:37
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/1964385 to your computer and use it in GitHub Desktop.
Save wpsmith/1964385 to your computer and use it in GitHub Desktop.
Changes the default embed sizes based on site layout
add_filter( 'embed_defaults', 'wps_embed_defaults' );
/**
* Changes the default embed sizes based on site layout
* via filtering wp_embed_defaults()
*
* @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 ) {
switch ( genesis_site_layout() ) {
case 'content-sidebar':
case 'sidebar-content':
$defaults = array( 'width' => 600, 'height' => 400 );
break;
case 'content-sidebar-sidebar':
case 'sidebar-content-sidebar':
case 'sidebar-sidebar-content':
$defaults = array( 'width' => 430, 'height' => 300 );
break;
default:
break;
}
return $defaults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment