Nowadays you can find Facebook “Like” and “Recommend” widgets on every website. One problem I have always found with sharing URLs on Facebook is that you often have no control over the image and description text that accompany the URL. I would like to share the solution to the problem.
Below are the details that I would like to share on Facebook wall, whenever user clicks on the share button. However you can change this values using different methods as for your requirements.
You can control sharing text, image and description with Facebook Open Graph also, but I am not going to use it here.
If you want to use FB Open graph API, please read – Facebook Open Graph META Tags
$title = urlencode('PHP7 Tutorials - ArjunPHP.com');
$url = urlencode('https://arjunphp.com');
$summary = urlencode('Web development tutorials by Arjun');
$image = urlencode('https://arjunphp.com/wp-content/themes/arjun/images/arjun_php_developer_blog.png');
Share on facebook wall!
When the user clicks the link, Window.open() will open a new window along with the ‘Share’ information.
That is it.
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.