Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Automatically add simple custom buttons for print, Facebook share, & Tweet in Posts [closed]

I decided to use the built in Facebook sharer and Twitter sharer links, as provided on each site. It won’t give complete functionality, but it it’s perfect for a simple custom icon.

Note: This will only work properly within ‘the loop’

HTML code to be inserted in your page template:

<div class="social_icons">
    <a href="https://wordpress.stackexchange.com/questions/125838/javascript:window.print()" target="_blank" class="printIcon">
       Print page
    </a>
    <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo get_permalink(); ?>" target="_blank" class="facebookIcon">
       Share on Facebook
    </a>
    <a href="https://twitter.com/share?text=<?php echo get_the_title(); ?>+&ndash;+" target="_blank" class="twitterIcon">
       Tweet on Twitter
    </a>
</div>

Basic CSS styling:

.social_icons {
    float: right; /*change for your specific needs*/
}

.social_icons a {
    text-indent: -9999px;
    height: 50px; /*change for your specific needs*/
    display: block;
    float: right; /*change for your specific needs*/
}

.social_icons a.printIcon {
    background-image: url(); /*add a custom share icon*/
    background-repeat: no-repeat;
}

.social_icons a.facebookIcon {
    background-image: url(); /*add a custom share icon*/
    background-repeat: no-repeat;
}

.social_icons a.twitterIcon {
    background-image: url(); /*add a custom share icon*/
    background-repeat: no-repeat;
}


Related Posts:

  1. Which social connect plugin do you recommend? [closed]
  2. How to generate “og:image” meta for Facebook sharing when the image in the post is not featured?
  3. How to integrate Facebook Share button without code?
  4. Whenever I am sharing a post wordpress phrase is automatically added, can anyone help?
  5. Post image lacking when pasting link into Facebook despite the correct og:image meta tag
  6. Trouble displaying featured image as thumbnail when using Facebook share
  7. No post image when pasting link into Facebook
  8. Store SNS share value via function.php
  9. How to install Facebook, Google+, & Twitter LIKE buttons for each individual post at frontpage?
  10. Featured image not showing on facebook share
  11. Featured Image and Facebook
  12. Facebook and Google+ sharing suddenly stopped working properly in WordPress
  13. Create Mashable Follow-like Facebook, Twitter login/connect?
  14. Publish post facebook page & twitter automatically [closed]
  15. Retrieving Default Image All Url Profile Picture from Facebook Graph API [closed]
  16. Official Facebook Connect button as PNG
  17. Use Device Login on Smart TV / Console
  18. Invisible characters – ASCII
  19. When do I need a fb:app_id or fb:admins?
  20. When do I need a fb:app_id or fb:admins?
  21. Warning: Each child in an array or iterator should have a unique “key” prop. Check the render method of `ListView`
  22. Warning: Each child in an array or iterator should have a unique “key” prop. Check the render method of `ListView`
  23. og:url is driving me crazy?
  24. Face recognition via facebook API
  25. FB is not defined javascript
  26. What are App Domains in Facebook Apps?
  27. How can I control the Facebook like image? [closed]
  28. How can I auto-add my posts to my site’s Facebook fan page?
  29. A plugin where users can comment with Facebook or Twitter or OpenID [closed]
  30. Automatically Facebook Debug Posts on Publish [closed]
  31. If your blog was an app on Facebook
  32. Get FaceBook Friend Count [closed]
  33. Facebook OAuth, WP_Http::request() vs wp_remote_request()
  34. Top 3 posts in last week ordered by Facebook and Twitter share counts
  35. W3 Cache plugin and Facebook sharing [closed]
  36. Twitter/Facebook login for comments [closed]
  37. Best way to allow manageable social media URLS?
  38. FB – Comment Moderation Tool bug? [duplicate]
  39. Any Facebook component doesn’t work on WordPress website after update. Why?
  40. Facebook sharer and parameters in URL
  41. How to control Facebook share information for the front page?
  42. sharing video on facebook from wordpress
  43. Adding a “most liked post” box, based on facebook ranking?
  44. Open graph metadata isn’t pulled on Facebook until after I run that specific link through the debugger
  45. Displaying additional User Contact Information
  46. facebook like – image display and description
  47. Is there a method or plugin that will allow posts to be sortable by Facebook likes?
  48. Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?
  49. How do I create a page for users to invite their facebook friends?
  50. Facebook Like Button in Jetpack [closed]
  51. Open graph problem: Showing wrong description of homepage while sharing on Facebook [closed]
  52. How do I remove all hyperlinks that begin with a #?
  53. Multiple social buttons with a fast loading? [closed]
  54. Simple plugins to post info about new blog entries?
  55. Facebook link to website logo
  56. Get User’s Facebook Photos as WordPress Upload
  57. Trigger a function immeditely after a user posted a comment
  58. Hiding styles from Facebook
  59. RSVP form for Facebook events from a WordPress post?
  60. WordPress comments and Facebook comments
  61. Building a Member Directory Site on WordPress with Facebook API Integration?
  62. Is it possible to use Twitter intents with the post’s image in WordPress?
  63. WP_Cron script not updating all posts in loop
  64. How to let user select role upon registration in Facebook-AWD?
  65. Choices for thumbnail image in a Facebook Link post
  66. Displaying Facebook comments count with tag
  67. Updating the Drag-To-Share eXtended share URLs?
  68. How to preserve exact formatting when copy pasting from Facebook into WordPress (or elsewhere)?
  69. Send Facebook server-side event using shortcode and Official Facebook Pixel plugin
  70. Posting to Facebook via WordPress – 500 Internal Error
  71. Sharing images to social media – issue with aspect ratio
  72. Remove text from my Facebook posts
  73. How can I echo og:video url, if the post has video content?
  74. fb share site shows blank image
  75. Facebook / LinkedIn share page – https opengraph issues [closed]
  76. Facebook preview Open Graph Object Debugger
  77. Facebook share functionality in wordpress loop
  78. Integrating Facebook calender to WordPress
  79. Open Graph in posts loop page
  80. Facebook social publisher and custom post type fields [closed]
  81. Is there a way of putting the facebook social plugins into page template php files?
  82. Conditional Facebook Share and Like links [closed]
  83. FB Comments box post to wall?
  84. How to add FB like + share AND also other Social Buttons on ALL pages and posts?
  85. Is there a social members only login plugin for WordPress? [closed]
  86. Website Preview Graphic for WordPress Site
  87. How do I set a featured image for the homepage? [closed]
  88. Can’t access site after plugin activation
  89. Use Facebook PHP SDK from WPBook
  90. Integrate open graph protocol without plugin?
  91. Adding a list of social media links
  92. I want to enable facebook connect how to do this?
  93. Facebook share image wrong on post not on debugger [closed]
  94. file_get_contents_curl pulling wrong values
  95. Facebook Registration Tool: how to use in WordPress? [closed]
  96. facebook like, tweet and google+1 buttons inside the loop on home, archive and search pages and missing facebook like buttons
  97. Facebook Like – Display counter starting at Zero?
  98. How to see more WordPress images when posting to Facebook
  99. Need To Change WordPress Meta Tags… Includes wordpress shortcodes
  100. WP REST API – log in with Facebook
Categories facebook Tags facebook, social-sharing, twitter
Posts and Pages not showing on admin, but showing in theme
woocommerce stored variable

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress