Created
June 7, 2015 08:06
-
-
Save m-pokrovskii/d818177b815017ca9d8b to your computer and use it in GitHub Desktop.
Get all images from post
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
<ul> | |
<?php | |
$doc = new DOMDocument(); | |
@$doc->loadHTML($post->post_content); | |
$tags = $doc->getElementsByTagName('img'); | |
foreach ($tags as $tag) { | |
echo '<li>'.$tag->getAttribute('src').'</li>'; | |
} | |
?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment