Skip to content

Instantly share code, notes, and snippets.

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