0

Hi I am trying to get a facebook share button to share the current post permalink page to no avail. Anyone help?

  <?php var $perma = '<?= get_the_permalink(); ?>';?>
  <a href="javascript:fbShare('<?php echo $perma ?>', 'FB Share', 'Facebook share popup', '<?php echo $perma ?>', 520, 350)">Share</a>

JS

   function fbShare(url, title, descr, image, winWidth, winHeight) {
    var winTop = (screen.height / 2) - (winHeight / 2);
    var winLeft = (screen.width / 2) - (winWidth / 2);
    window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
   }
0

All good I have figured it out

<a href="javascript:fbShare('<?php echo the_permalink(); ?>', 'FB Share', 'Facebook share popup', '<?php echo the_permalink(); ?>', 520, 350)">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.