On click I want to open a popup window which will allow my visitors to share my blog via FACEBOOk. Everything works great, but the problem is I cant get the permalink of the current article. How to add php in javascript?
// Replace the images with the following div and pin button
$button_div = '<div class="plugin">
<div class="imgshare">
<div class="postfb">
<a onclick="popItUp()">
<img src="http://ift.tt/1DkDhoJ" width="45px" />
</a>
</div>
</div>
<div class="demo"><img$1src="$2.$3" $4 width="$5" height="$6" /></div> </div>
';
// Replace the images with a containing div with a pin button on the image
$content = preg_replace( $pattern, $button_div, $content );
return $content;
}
}
<script>
function popItUp(url) {
var newWindow = window.open('http://ift.tt/1geI7E3 the_permalink(); ?>&title=<?php the_title(); ?>', 'name', 'height=615,width=475,scrollbars=yes');
if (newWindow.focus) {
newWindow.focus();
}
}
</script>
Aucun commentaire:
Enregistrer un commentaire