Created
April 3, 2014 17:08
-
-
Save kingkool68/9958613 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function chris_coyiers_super_awesome_feed_image_magic( $content ) { | |
$doc = new DOMDocument(); | |
$doc->LoadHTML( $content ); | |
$images = $doc->getElementsByTagName('img'); | |
foreach ($images as $image) { | |
// Set the new attribute. | |
$image->setAttribute( 'style', 'max-width:480px;' ); | |
} | |
return $doc->saveHTML(); | |
} | |
add_filter( 'the_content_feed', 'chris_coyiers_super_awesome_feed_image_magic' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment