foreach ($feed->get_items(0 , 3) as $item):
$feedDescription = $item->get_content();
$image = returnImage($feedDescription);
$image = scrapeImage($image);
$image_url= $item->get_permalink();
$description = $item->get_description();
?>
<div class="item">
<h4><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h4>
<div class="image-box"><?php echo '<a href="' . $image_url . '"><img src="' . $image . '" /></a>'."\n";?></div>
<p><?php echo $description ?></p>
<p><a href="<?php echo $item->get_permalink(); ?>">Continue Reading</a></p>
</div>
<?php endforeach; ?>
Here is the html output:
<div class="item">
<h4><a href="#">Lorem Ipsum</a></h4>
<div class="image-box"><a href="#"><img src="image.jpg"></a>
</div>
<p></p>
<div>Lorem Ipsum description [...]</div>
<p></p>
<p><a href="#">Continue Reading</a></p>
</div>
Why does the description call add a div tag and not get wrapped in the paragraph tag?
That is not a problem of SimplePie... well, not directly. Try to test this html-block:
<div class="item">
<h2><a href="http://#">Title</a></h2>
<p><div><span>Description</span></div></p>
<p><small>Posted on TODAY</small></p>
</div>
You will see that here the behaviour is the same. The problem is, that the post you get from simplepie is encapsulated in a DIV. And inserting a DIV into a paragraph results in a seperation of both.
So you could try to delete the enclosing DIV in PHP with a regexp or with jQuery, for instance.