Please Login or Register to continue.


I have created social links for the blog post in PHP but when I am sharing it's not showing that blog picture.

Every time when I am sharing a blog it's not sharing that blog description and blog image.

It's taking page image and Its meta description.  How can I change the description for every new blog post which I am sharing?

This is the code of blog post sharing. 

<div class="pro-bot-shar">

            <h4>Share this post</h4>


            $fb_url = $webpage_full_link. "blog-details?src=facebook&&row=".$blog_codea;  //URL Blog Detail  Facebook Link

            $fb_link = urlencode($fb_url);

            $twitter_url = $webpage_full_link. "blog-details?src=twitter&&row=".$blog_codea;  //URL Blog Detail Twitter Link

            $twitter_link = urlencode($twitter_url);

            $linkedin_url = $webpage_full_link. "blog-details?src=linkedin&&row=".$blog_codea;  //URL Blog Detail Linkedin Link

            $linkedin_link = urlencode($linkedin_url);

            $whatsapp_url = $webpage_full_link. "blog-details?src=whatsapp&&row=".$blog_codea;  //URL Blog Detail Whatsapp Link

            $whatsapp_link = urlencode($whatsapp_url);




                    <div class="sh-pro-shar sh-pro-face">

                        <a target="_blank" href="http://www.faceboo

k.com/sharer/sharer.php?href=<?php echo $fb_link; ?>"><img src="images/social/3.png" alt=""> Facebook</a>




                    <div class="sh-pro-shar sh-pro-twi">

                        <a target="_blank" href="http://twitter.com/share?text=<?php echo $events_a_row['event_name']; ?>&url=<?php echo $twitter_link; ?>"><img src="images/social/2.png" alt=""> Twitter</a>




                    <div class="sh-pro-shar sh-pro-link">

                        <a target="_blank" href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo $linkedin_link; ?>"><img src="images/social/1.png" alt=""> Linkedin</a>




                    <div class="sh-pro-shar sh-pro-what">

                        <a target="_blank" href="whatsapp://send?text=<?php echo $whatsapp_link; ?>" data-action="share/whatsapp/share"><img src="images/social/6.png" alt=""> WhatsApp</a>






(120 Points)
in PHP


6 Answers
(9.4K Points)

This is a simple method to create social share buttons or icons in PHP with an MYSQL database. You can share only the link without description and blog post image. It depends on social share platforms like Facebook, Twitter, LinkedIn, Pinterest, etc. Facebook allows to share the links only and after the share link, you can write a short description on Facebook. Facebook fetches description automatically.  It's all depends on the social share networking site. Let's discuss twitter. You can share tags and page URLs with twitter sharing links. You can use the post title also. 

<a target="_blank" href="http://twitter.com/share?text=Visit the link &url=<?php echo $baseUrl.$slug; ?>&hashtags=blog,technosmarter,programming,tutorials,codes,examples,language,development">

Output- Try the link 

http://twitter.com/share?text= create-social-share-buttons-in-the-blog-using-php-and-mysql %7C PHP Tutorials &url=https://technosmarter.com/php/create-social-share-buttons-in-the-blog-using-php-and-mysql&hashtags=technosmarter,php,programming,tutorials

You can check other sharing links here - 

Create social share buttons in the blog using PHP and MYSQL

Actually i already created social share link but when i m clicking for facebook it automatically take website icon but not aking that blog picture. Can you please tell how to give meta description for blogs individually
vijay1996 15 Apr 2020
This is answered by vishalrana1. You should check.
shakti 15 Apr 2020

(7.3K Points)

We can share only links and text on social share sites if they allow. Social sites fetch images automatically if possible. The social site helps to share links, text or tags. You can check share URLs for that. 

If you want to set your meta description then follow the steps - 

Select short description form MySQL database 

Use meta description and echo the short description like this - 


  <meta name="description" content="<?php $postshortdesc ; ?>">  


SEO part is more important for a blog. You can use HTML meta tags. In the example above, I used the meta description. 


(4.3K Points)

The blog system requires more than one table for operations. If you want to create a unique description for every single post then you have to create a column in your table. 

1. Create a column in your blog table - blogDesc

2. Insert post with description. Create a text area for a short description.

3. Use this column for SEO purposes. Select data from the database and echo with meta description. 


  <meta name="description" content="<?php $blogDesc ; ?>">  


In this way, you can create a unique description for each blog post. 


(4.3K Points)

If you are sharing your blog posts and images are not showing then you should use social share plugins 

Facebook social share plugin 


Twitter Social Plugin 






Use the links above and implement them. 


(7.3K Points)

Blog post images depend on the feature image and content images. Social sites fetch the image from your blog post page. You should use images with the blog posts. When you share blog posts on Facebook or another platform then social sites fetch images and descriptions from your blog post. Upload and attach unique images for different blog posts. 

You should create a unique description for each blog post. 

I had created one blog in php and all new blog in stored in database so whenever i am sharing that blog its taking my website logo and description. How to give unique image and description for that particular blog?
vijay1996 24 Apr 2020
I have answered your question. Add images for each blog post and get images on the Facebook share page. The image should be unique for each blog post and share unique links.
vishalrana1 24 Apr 2020

(430 Points)

You are looking for social share links. If you want to share the blog post feature image on social sites then you should use meta properties. You will be able to share the post image on the PHP website. Along with feature images, you will be able to share website titles, post descriptions.  

 Share blog post image on social share sites like - Twitter, Facebook, Linkedin  

First of all, create social share buttons -  

Create social share buttons in the blog using PHP and MYSQL

Now, add meta in the <head> ......    </head> section. 

<meta property="og:url"           content="your-domain.com/your-page.html" />

  <meta property="og:type"          content="website" />

  <meta property="og:title"         content="Your Website Title" />

  <meta property="og:description"   content="Your description" />

  <meta property="og:image"         content="your-domain.com/path/image.jpg" />

 Provide the image path and other content from the MYSQ database. 

It will help to share your blog post feature image on social networking sites. 


Related Questions :-

Featured Items:-

Certificate system in PHP website | PHP scripts


Home Credito loan finance management multipurpose system in PHP


Result management system with Marksheet in PHP website | PHP Scripts


Your Answer

You can post your answer after login..