Your cart is currently empty!
[PHP] URL ทำปุ่มแชร์ Share Social Facebook, Twitter, Google Plus ต่าง ๆ
เพิ่มเติม: เดี๋ยวนี้ PHP มี Function ช่วย Generate URL ด้วย: http://php.net/manual/en/function.http-build-query.php
บางทีตอนทำปุ่มแชร์ ถ้าใช้ปุ่มที่แต่ละเจ้ามีโค้ดให้อยู่แล้วก็สะดวกดี แต่มันทำให้เว็บโหลดช้า เพราะฉะนั้นสร้างปุ่มแชร์เอง แล้วใส่ URL เข้าไปดีกว่า
โค้ดตัวอย่างการใช้งาน
<?php // Collect Share Count $post_permalink = get_permalink(); $post_permalink_encode = rawurlencode( $post_permalink ); ?> <a target="_blank" href="http://www.facebook.com/sharer.php?u=<?php echo $post_permalink_encode; ?>">Share Facebook</a>
เพิ่มเติมของปุ่ม Pocket ให้ หายากมาก ไม่ค่อยมีคนพูดถึง
https://getpocket.com/save?url=<?php echo $post_permalink_encode; ?>
บทความที่เกี่ยวข้อง: วิธีดึงเลขแชร์ Social Media (Facebook)
Reference: https://gist.github.com/dr-dimitru/7164862
by
Tags:
Leave a Reply