I made a shortcut function in Wordpress
which is making a Facebook share button
. My problem is that how can I know that did the user share my post?
I read some post that is using Javascript
to get back the Facebook response
.How can I do with my PHP code
?
Here is my code:
function add_share_button($atts, $content = null )
{
$atts = shortcode_atts(
array(
'url' => 'https://www.google.com.hk/',
'layout' => 'button'
), $atts
);
return '<div class = "fb-share-button" data-href="'.$atts['url'].'" data-layout="button"></div>';
}
add_shortcode('test_lmc', 'add_share_button');