Facebook Quote Plugin for Blockquote?
I'm working on developing a plugin for Wordpress to enable social share buttons inside blockquotes (to share the quoted text on social networks Twitter and Facebook). So that sites would look like this:
Here's the current js:
jQuery(document).ready(function () {
var blockquotes = jQuery('blockquote');
for (var i = 0; i blockquotes.length; i++) {
var blockQuoteText = jQuery(blockquotes[i]).text();
var currentUrl = window.location;
var textColor = jQuery(blockquotes[i]).css('color');
// add share buttons (change TwitterName to your Twitter handle for automatic mentions)
// change paths to the icons to suit your installation (download link below)
jQuery(blockquotes[i]).append('div class="quote-share"div class="wrapper"' +
'a class="quote-twitter pop-up" style="color:' + textColor + '"' +
'href="http://twitter.com/intent/tweet?status=' + blockQuoteText + '+' + currentUrl + '+%40' + data.twitter_id + '"' +
'span class="icon-twitter"//a' +
'a class="quote-facebook pop-up" style="color:' + textColor + '"' +
'href="https://www.facebook.com/sharer/sharer.php?u=' + currentUrl + 'amp;src=sdkpreparsetitle=' + blockQuoteText + '"' +
'span class="icon-facebook"/' +
'/a/div/div');
}
// pop-up without being blocked by pop-up blockers
jQuery('a.pop-up').live('click', function () {
newwindow = window.open(jQuery(this).attr('href'), '', 'height=640,width=600');
if (window.focus) {
newwindow.focus()
}
return false;
});
});
But then I came across Facebook's Quote plugin: https://developers.facebook.com/docs/plugins/quote Which would be perfect, but I can't figure out how to attach the plugin script to an icon, rather than the way they enabled it which is by highlighting text. Could anyone help me out with how to attach the new "Quote" sharing function for Facebook to a button than would then share the text within the blockquote?
Topic facebook plugins Wordpress javascript
Category Web