Created
March 3, 2012 04:37
-
-
Save wpsmith/1964385 to your computer and use it in GitHub Desktop.
Changes the default embed sizes based on site layout
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
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