First of all you will need a Facebook App, you can create one here. After that copy the App ID and Secret to the settings section on WordPress dashboard.

To use it just copy the Facebook url on a separate line on the content of any post, this plugin will fetch data associated with that url and display it. If the data is not public, like “invite only” events or private profiles it will return a link.

Shortcodes


If you need to modify a particular embed you can alter it using the ShortCode.

Example:

[facebook https://www.facebook.com/sydneyoperahouse social_plugin=true width=230 posts=5 theme=default ]

  • social_plugin will try to embed the url as Facebook’s social plugin.
  • width works on all kinds of embeds, it’s value is on pixels.
  • posts works only on page embeds, and represents the number of posts to show.
  • theme choose the template to use to render the embeds, can be default or classic.

All of these attributes are optional and if they are not present it will use the default settings.

For further information and examples please check our article: WP Embed Facebook Shortcode attributes and examples: http://www.wpembedfb.com/shortcode-attributes-and-examples/

WP Embed Facebook Premium

Shortcode examples.

Full Page Shortcode

[fbfullpage https://www.facebook.com/SimonandSeaforts ]

Full Event Shortcode

[fbfullevent https://www.facebook.com/events/601378816638561 ]

Extending


To change the way the embeds look or add/remove data, you need to create your own templates for the embeds, to do that follow this steps.

  1. Create a folder on you theme named “plugins”.
  2. Inside that folder create a new one named “wp-embed-facebook”.
  3. Inside wp-embed-facebook folder create a new one named default
  4. Copy the contents of “wp-embed-facebook/templates/default/” to “your-theme/plugins/wp-embed-facebook/default

Inside each template file you can access the $fb_data array that contains the information retrieved from facebook.

Filters


wpemfb_embed_type

  • Since: 1.8
  • $type string The detected type of embed
  • $clean array The url parts of the request

Change the detected embed type.

wpemfb_api_string

  • Since: 1.9
  • $api_string string The fb api request string according to type
  • $fb_id string The id of the object being requested
  • $type string The detected type of embed

Modify according to type the request string to the Facebook API.

wpemfb_2nd_api_string

  • Since: 1.9
  • $api_string2 string The fb api request string according to type
  • $fb_data arrray The result from the first query
  • $type string The detected type of embed

Modify the seccond api query in case it is needed.

wpemfb_fb_data

  • Since: 1.9
  • $fb_data arrray The query result
  • $type string The detected type of embed

Filter the complete result from the query.

wpemfb_category_template

  • Since: 1.0
  • $default arrray Full path for the template
  • $category string Facebook page category

Add a new template for a specific facebook category.

For example a Museum create the new template at your-theme/plugins/wp-embed-facebook/museum.php then on functions.php of your theme.

 

wpemfb_template

  • Since: 1.8
  • $template string Template Full Path
  • $fb_data arrray The query result

Change the template acording to the result of the query