-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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