Skip to content

Instantly share code, notes, and snippets.

@leobaiano
Created January 31, 2014 18:42
Show Gist options
  • Save leobaiano/8739582 to your computer and use it in GitHub Desktop.
Save leobaiano/8739582 to your computer and use it in GitHub Desktop.
Enviar notificação quando o post receber comentários no form de comments do facebook (WordPress)
jQuery(function($) {
$.data(document.body, 'ajaxUrl', '<?php echo admin_url('admin-ajax.php'); ?>');
FB.init({
appId : '1419904448233697',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('comment.create',
function(response) {
var post_url = response.href;
$.get($.data(document.body, 'ajaxUrl' ), {
action: 'facebook_comment_post',
post_url: post_url
},
function(data){
},
"json"
);
}
);
FB.Event.subscribe('comment.remove',
function (response) {
var post_url = response.href;
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment