FB Last Posts

A very tiny plugin that helps you to show last Facebook posts of certain page, group or timeline on your site.

Author:vitalikaz (profile at wordpress.org)
WordPress version required:3.0.1
WordPress version tested:4.0
Plugin version:1.0
Added to WordPress repository:15-09-2014
Last updated:15-09-2014
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:4
Plugin URI:
Total downloads:2 406
Active installs:100+
plugin download
Click to start download

This plugin allows you to show posts from Facebook pages, groups and timelines directly on your website in a very simple way. Plugin does not register shortcodes, JS scripts or any extra libraries, so it's extremely clean & tiny and you are free to decide how your recent Facebook posts listing will look like.

If you are a fan of clean code (like me) without tons of extra scripts for plugin to work, you will definitely like this plugin. It's extremely fast as it does not any unnecessary work and cleverly caches results.

Sample Usage

<?php
// try to get posts from Facebook
$fb_posts = fb_get_last_posts(10);

// check if result is not a WP error
if (!is_wp_error($fb_posts)):
    // loop through posts and show them
    foreach($fb_posts as $fb_post): ?>
        <div>
            <span class="author"><?php print esc_html($fb_post['author_name']);?></span>,
            <span class="date"><?php print date(get_option('date_format'), strtotime($fb_post['created_time']));?></span>
            <p><?php print esc_html($fb_post['message']); ?></p>
            <a href="<?php print $fb_post['permalink'];?>">Original post</a>
        </div>
    <?php endforeach;
else: 
    // or display an error ?>
    <div><?php print esc_html($fb_posts->get_error_message());?></div>
<?php endif; ?>