/ Published in: PHP
Relies on "trunCate" a truncating function.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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 ){ $cutcontent = trunCate($content,160, " "); echo '<p>' . $cutcontent . '</p>'; } }