How to add an ‘email this’ link to your WordPress posts
I’ve noticed many of my website visitors come to my websites via links sent in emails. I thought I’d make it easier for visitors to email links by putting an ‘email this page’ link at the bottom of each post.
You’ll want to add this link to both the index.php and the single.php pages in your theme. Every theme is different so I can’t tell you exactly where to add it. I find the comments section in those pages and work my way up to where the date, tags or other miscellany is stored and added them there on my themes.
<a href=”mailto:?subject=<?php urlencode(the_title()) ?>&body=<?php urlencode(the_permalink()) ?>”>Email this page</a></p>
You might also check out James Wilkes Design version of the link He is pickier than I about the encoding.
How to add ‘Twitter This’ links to your WordPress Posts
Twitter seems to be the preferred social network now so I decided I needed some ‘Twitter This’ links on my WordPress Blogs.
You’ll want to add this link to both the index.php and the single.php pages in your theme. Every theme is different so I can’t tell you exactly where to add it. I find the comments section in those pages and work my way up to where the date, tags or other miscellany is stored and added them there on my themes.
The link you’ll want is:
<p><a href=”http://twitter.com/home?status=Reading:<?php echo urlencode(get_permalink(get_the_ID())); ?>&title=<?php echo urlencode(get_the_title(get_the_ID())); ?>”>Twitter this</a></p>
You might also check out James Wilkes Design version of the link He is pickier than I about the encoding.
Many thanks to:
Jamie Huskisson and to James Wilkes Design who gave me the pieces I needed to put the link together correctly.