Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plcosta/93da1b9451db6abaa889eeae5b07fc39 to your computer and use it in GitHub Desktop.
Save plcosta/93da1b9451db6abaa889eeae5b07fc39 to your computer and use it in GitHub Desktop.
Dynamically load Facebook comments on your site (if you already have the FB API running)
jQuery( function( $ ) {
if ( 'undefined' === typeof FB )
return;
if ( $( 'body' ).hasClass( 'single-post' ) || $( 'body' ).hasClass( 'page' ) ) {
var $comments_div = $( '<div/>' );
$comments_div.addClass( 'fb-comments' );
$comments_div.attr( 'data-href', document.location );
$comments_div.appendTo( $( '.primary-content' ) );
FB.XFBML.parse();
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment