Info
- 3 posts
- 3 voices
- Started 2 years ago by michaelphill
- Latest reply from Ashfame
- This topic is not resolved
Display latest posts on other page
-
- Posted 2 years ago #
I'm looking for a plugin that will allow me to display the last 5 or so posts in a designated forum on another page outside of the BBPress/WP installation.
Something similar to thisL
http://bbpress.org/plugins/topic/bbpress-latest-discussion-for-wp/
Any suggestions?
-
- Posted 2 years ago #
Couldn't you just take the latest posts RSS feed and use that in your other page?
-
- Posted 2 years ago #
Use this in header :
<?php // URL location of your feed $feedUrl = "http://feeds2.feedburner.com/ashfameblog?format=xml"; // Replace the above URL with yours $feedContent = ""; // Fetch feed from URL $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $feedUrl); curl_setopt($curl, CURLOPT_TIMEOUT, 3); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); // FeedBurner requires a proper USER-AGENT... curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"); $feedContent = curl_exec($curl); curl_close($curl); ?>Use this to show :
<?php $count=0; // Did we get feed content? if($feedContent && !empty($feedContent)) { $feedXml = @simplexml_load_string($feedContent); if($feedXml) { ?> <ul> <?php foreach($feedXml->channel->item as $item): if($count==6) { break; } ?> <li><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></li> <?php $count++; endforeach; ?> </ul> <?php }} ?> -
You must log in to post.