I want an easy way to automatically implement printing, Facebook sharing, and Tweeting for posts. No plugins, complicated javascript, nor functions.
-
Can you add more details about the issue you are facing?– Maruti MohantyDec 9, 2013 at 13:40
-
1I'm not facing an issue. I'm presenting a potential solution to help others... I would answer my own question, but I don't have enough reputation.– NatanDec 9, 2013 at 15:00
-
2@Natan Everyone can answer the own question. You just have to wait a little bit longer.– fuxia ♦Dec 9, 2013 at 15:22
-
Whoops. My mistake. #_#– NatanDec 9, 2013 at 15:27
1 Answer
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="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(); ?>+–+" 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;
}