Blog Post Icon
Blog
06/22/2016

WordPress plugin to integrate your Facebook page feed

Hello!

We have created yet another WordPress plugin! We are highly motivated to roll out any and all WordPress custom development as a neatly packaged plugin for the general public to use. We have many more ideas and many more plugins in the works.

Check out the plugin here
This latest plugin, recently approved by the WordPress plugin auditing community, pulls your Facebook page’s feed and injects it into your site anywhere (by use of a simple shortcode). As with other similar Facebook plugins, this plugin requires you to generate a simple Facebook app with API key/secrets in order to connect and pull the data.

The plugin utilizes the PHP Facebook SDK in order to connect and pull the data. I’ll walk you through the different parts of the plugin’s code, however if you’re interested click the SDK link to read more about how the Facebook SDK works.

Load Facebook’s SDK

// Require facebook php library
require_once plugin_dir_path( __FILE__ ) . 'facebook/facebook.php';

Pretty simple, right? We simply packaged the SDK with our plugin and are requiring it at the top of our file. SDK updates can simply be integrated and updated this way, provided functions and variables that are dependent on the SDK do not fundamentally change.

Create admin menu options

One thing we’re doing here that we did not do with our previous plugin is have admin area options to define variables that the shortcode will use to connect to facebook. All we really need is the Facebook App ID, App Secret and Page name. These requirements are pretty self explanatory, so in the plugin’s code we define the admin options that will hold this information.

function shift8_fbfeed_create_menu() {
        //create new top-level menu
        add_menu_page('Shift8 FB Feed Settings', 'Shift8', 'administrator', __FILE__, 'shift8_main_page' , 'dashicons-building' );
        add_submenu_page(__FILE__, 'Facebook Feed Settings', 'Facebook Feed Settings', 'manage_options', __FILE__.'/custom', 'shift8_fbfeed_settings_page');
        //call register settings function
        add_action( 'admin_init', 'register_shift8_fbfeed_settings' );
}


function register_shift8_fbfeed_settings() {
        //register our settings
        register_setting( 'shift8-fbfeed-settings-group', 'fb_app_id' );
        register_setting( 'shift8-fbfeed-settings-group', 'fb_app_secret' );
        register_setting( 'shift8-fbfeed-settings-group', 'fb_page_name' );
}

// Admin settings page
function shift8_fbfeed_settings_page() {
?>

 

Shift8 Facebook Feed

 

 

Facebook App ID
Facebook App Secret
Facebook Page Name

 

 

 

To give you an idea of what you could do, see the example CSS styling below which would produce something styled similar to the screenshot here.

.frontfb-list {
	list-style:none;
	display: inline-block;
	padding: 10px;
}
.frontfb-item {
	border-top: 2px solid #DDD;
	padding-bottom: 25px;
	padding-top: 15px;
	color: #000;
	font-size: 12px;
	height:100%;
	overflow: auto;	
}
.frontfb-bottom {
	width:100%;
}
.frontfb-itemtext {
	width:100%;
}

.frontfb-image {
	float:right;
	padding-right:15px;
}

At Shift8, we cater to all sorts of businesses in and around Toronto from small, medium, large and enterprise projects. We are comfortable adapting to your existing processes and try our best to compliment communication and collaboration to the point where every step of the way is as efficient as possible.

Our projects are typically broken into 5 or 6 key “milestones” which focus heavily on the design collaboration in the early stages. We mock-up any interactive or unique page within your new website so that you get a clear picture of exactly how your design vision will be translated into a functional website.

Using tools like Basecamp and Redpen, we try to make the process simple yet fun and effective. We will revise your vision as many times as necessary until you are 100% happy, before moving to the functional, content integration and development phases of the project.

For the projects that are more development heavy, we make sure a considerable amount of effort is spent in the preliminary stages of project planning. We strongly believe that full transparency with a project development plan ensures that expectations are met on both sides between us and the client. We want to ensure that the project is broken into intelligent phases with accurate budgetary and timeline breakdowns.

Approved design mock-ups get translated into a browse-ready project site where we revise again and again until you are satisfied. Client satisfaction is our lifeblood and main motivation. We aren’t happy until you are.

Need Web Design?

Fill out the form to get a free consultation.

shift8 web toronto – 416-479-0685
203A-116 geary ave. toronto, on M6H 4H1, Canada
© 2024. All Rights Reserved by Star Dot Hosting Inc.

contact us
phone: 416-479-0685
toll free: 1-866-932-9083 (press 1)
email: sales@shift8web.com

Shift8 Logo