Return to Snippet

Revision: 56197
at March 15, 2012 11:44 by rliverman


Initial Code
// Recent facebooks function 
	function recentFacebooks($fbID, $number){ 
		include_once(ABSPATH.WPINC.'/rss.php');
		
		$fbpost = fetch_feed("http://www.facebook.com/feeds/page.php?id=" . $fbID . "&format=rss20"); 
		
		if (!is_wp_error( $fbpost ) ) : 
		$maxitems = $fbpost->get_item_quantity($number);  
		$rss_items = $fbpost->get_items(0, $maxitems);  
		endif;
		
		if ($maxitems == 0) echo '<p>No Recent Posts.</p>'; 
		else foreach ( $rss_items as $item ){
		
		$content = html_entity_decode($item->get_content()); 
		$cutcontent = trunCate($content,160, " ");
		
		echo '<p>' . $cutcontent . '</p>';
		}
	}

Initial URL

                                

Initial Description
Relies on "trunCate" a truncating function.

Initial Title
Facebook Retrieve Recent Facebook Post(s) with Simple Pie RSS and PHP

Initial Tags
php, wordpress, simple, facebook

Initial Language
PHP