nitzan

Avatar

One Handy Loop

This one loop will most prob­a­bly change the most useful pieace of code i can rec­om­mend of.

This would pull an rss of your choice and list the number an item you choose.

(the list markup seems the rea­son­able one to use but this up to your needs)

<ul>
<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss("[YOUR FEED HERE]“);
$maxitems = [YOUR NUM OF ITEMS];
$items = array_slice($rss->items, 0, $maxitems);
?>
<ul>
<?php if (empty($items)) echo ‘<li>No items</li>’;
else
foreach ( $items as $item ) : ?>
<li><a href=’<?php echo $item['link']; ?>’ 
title=’<?php echo $item['title']; ?>’>
<?php echo $item['title']; ?>
</a></li>
<?php endforeach; ?>
</ul>

Realted Posts

 
close Reblog this comment
blog comments powered by Disqus


Twits


Recent comments


Inspiration via fffound

LUKE CHUEH : INSPIRATION (BRIGHT IDEAS FROM THE HOLE IN MY SOUL) [REVISITED]

Send me your track