<?php /* Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop. */ function contains_badwords($item, $badwords) { foreach ($badwords as $badword) { if (stripos($item->get_title(), $badword) !== false || stripos($item->get_description(), $badword) !== false) { return true; } } return false; } foreach ($news->get_items(0, 5) as $item): if (contains_badwords($item, array('sex', 'drugs', 'rock', 'roll'): ?> <div> <h3><a href="<?php echo $item->get_permalink(); ?>"target="_blank"><?php echo $item->get_title(); ?></a></h3> <p><?php echo $item->get_date('j M Y | g:i a T'); ?></p> <p><?php echo $item->get_description(); ?></p> <p></p> <div class="break"> </div> </div> <?php endif; endforeach; ?>