In today’s digital landscape, social media sharing has become a vital aspect of online presence and content dissemination. Integrating social sharing buttons into websites not only enhances user engagement but also extends the reach of content across various platforms. Adding a Pinterest Share button to a PHP website allows visitors to effortlessly share website content on their Pinterest boards, thereby increasing visibility and driving traffic to the site.
This comprehensive guide aims to provide a detailed walkthrough of adding a Pinterest Share button to a PHP website. Whether you’re a novice or an experienced developer, this tutorial will guide you through the process, ensuring seamless integration of the Share button into your website.
Read More: How To Add Facebook Share Button in PHP Website?
Let’s get started.
Sample Application Setup
Create a file named as “index.php“. Write the following code into it,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>How To Add pinterest Share Button in PHP - Online Web Tutor</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h2>How To Add Pinterest Share Button in PHP - Online Web Tutor</h2>
<?php
$url = "https://onlinewebtutorblog.com/laravel-11-new-features-and-updates/";
$image = "https://onlinewebtutorblog.com/wp-content/uploads/2024/02/laravel-11-latest-updates-and-features.jpg";
$title = "What's New in Laravel 11: New Features and Latest Updates
";
?>
<a href="javascript:window.open('http://pinterest.com/pin/create/link/?url=
<?php echo $url ?>&media=<?php echo $image ?>&description=<?php echo $title ?>', '_blank', 'width=400,height=500');void(0);" class="btn btn-danger">Share on Pinterest</a>
</div>
</body>
</html>Output

That’s it.
We hope this article helped you to learn about “How To Add Pinterest Share Button in PHP Website” in a explained way.
If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.
Read more