Skip to content

Instantly share code, notes, and snippets.

@gyrus
Created July 21, 2012 21:15
Show Gist options
  • Select an option

  • Save gyrus/3157207 to your computer and use it in GitHub Desktop.

Select an option

Save gyrus/3157207 to your computer and use it in GitHub Desktop.
Fix height of Flickr slideshows embedded in WordPress
<?php
/**
* Fix height of embedded Flickr slideshows
*/
add_filter( 'oembed_result', 'pilau_fix_flickr_slideshow_height', 10, 3 );
function pilau_fix_flickr_slideshow_height( $html, $url, $args ) {
if ( strpos( $url, "flickr.com" ) !== false && substr( $url, -6 ) == "/show/" )
$html = preg_replace( '/ height="([^"]+)"/', ' height="350"', $html );
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment