I have a foreach loop which loops and shows all the data in an array without a problem, however I have some jQuery I want applying to the results, but the jQuery only works on the first piece of data to be displayed. I am not really sure why, if anyone could help that would be great.
$count_limit = 0;
$limit = 5;
foreach ( $feeds->data as $item ) {
extract( (array) $item );
if($count_limit++ < $limit){
?>
<div id="news_post">
<? $title_str = str_replace('–', '–', $title) ?>
<p class="news_title"><a href="<?php echo $link; ?>" target="_blank"><?php echo $title_str; ?></a> <a href="#" class="read">read...</a></p>
<div class="news_desc"><?php echo "$description" ?></div>
</div>
<? }
else {
break;
}
$(this).next('.news_desc').hide();
$(this).next('a.read').click(function() {
$(this).next('.news_desc').toggle();
});
<a href="<?php echo $link; ?>"*facepalm