Golf Course Ladder -- Golf Clubs, Golf Courses, and Golfing


Add Latest Golf Posts To Your Website

Apparently this has ability has been built into wordpress for quite some time but a friend of mine recently pointed up that it can be done (pfblogs popular posts added to sidebar.)  Here is the wordpress codex for this feature: http://codex.wordpress.org/Function_Reference/fetch_rss.

To add the latest golf posts to my sidebar I added the following to my theme…

<h3>Latest Golf Posts</h3>
<?php 
// Get RSS Feed(s)
include_once(ABSPATH WPINC ‘/rss.php’
);
$rss fetch_rss(http://www.bloggersgolf.com/feed’
);
$maxitems = 10
;
$items array_slice($rss->items0$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> (<?php echo $item[‘dc’][‘creator’]?>)</li>
<?php endforeach; 
?>
</ul>



comments

Leave a Reply