i use this code:
<?php
$i = 0;
$page = get_the_content();
$doc=new DOMDocument();
$doc->loadHTML($page);
$xml=simplexml_import_dom($doc);
$images=$xml->xpath('//img');
foreach ($images as $img) {
list($width, $height, $type, $attr) = getimagesize($img['src']);
if ($height > 149 ) {
echo '<img src="' . $img['src'] . '" alt=" ' . $img['alt'] . ' - funny and hot pictures" title=" ' . $img['title'] . ' - funny fail picture dump" onerror=\'this.style.display="none" \'><br>';
$i++;
if ($i == 3 ) { break;}
}
else
{
// don't display
}
}
?>
... to replace the "<?php the_content(); ?> peice of code in my index and single.php files. what it does is get only images from my rss feeds and remove all of the text. what i want it do do is allow it to post youtube videos also since almost all of my feeds use both images and videos. when my feed autoposts a video the php gets broken and my wordpress theme gets all weird looking.
can someone help me let my feeds autopost vidoes too?
<?php
$i = 0;
$page = get_the_content();
$doc=new DOMDocument();
$doc->loadHTML($page);
$xml=simplexml_import_dom($doc);
$images=$xml->xpath('//img');
foreach ($images as $img) {
list($width, $height, $type, $attr) = getimagesize($img['src']);
if ($height > 149 ) {
echo '<img src="' . $img['src'] . '" alt=" ' . $img['alt'] . ' - funny and hot pictures" title=" ' . $img['title'] . ' - funny fail picture dump" onerror=\'this.style.display="none" \'><br>';
$i++;
if ($i == 3 ) { break;}
}
else
{
// don't display
}
}
?>
... to replace the "<?php the_content(); ?> peice of code in my index and single.php files. what it does is get only images from my rss feeds and remove all of the text. what i want it do do is allow it to post youtube videos also since almost all of my feeds use both images and videos. when my feed autoposts a video the php gets broken and my wordpress theme gets all weird looking.
can someone help me let my feeds autopost vidoes too?