Welcome to Techno Smarter QA, Question, Answer forum. Ask questions, receive answers, or help someone. Join Now
Welcome to Techno Smarter Q&A, where you can ask questions and receive answers from other members of the community. Ask the Technical & Programming related questions that you want. Join our community and help others .
+4 votes

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.

Its 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>





in PHP by (120 points) 2 3 9

6 Answers

+4 votes

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

by (9.1k points) 11 25 63
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
This is answered by vishalrana1. You should check.
+4 votes

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. 

by (7.2k points) 14 29 62
+3 votes

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. 

by (4k points) 8 29 54
+3 votes

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. 

by (4k points) 8 29 54
+2 votes

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. 

by (7.2k points) 14 29 62
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?
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.
+1 vote

You are looking form 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 image, you will be able to share website title, post description.  

 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. 

by (430 points) 1 5