Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.