And yet another great and simple hack that will make you smile!
This is how I create the simple “Email Post” functionality on every single post dynamically without a plugin.
Super easy and super effective!
My reason behind this was simple: More than a few people have told me they’ve emailed the post to friends, staff, and others and I thought that in my redesign I should make it even easier for them.
What it does is simply boot up the user’s email client (like Apple Mail) and auto populate the Subject: and also provides the link in the body.
Superb!
Here’s my code:
<a href="mailto:?subject=<?php the_title(); ?> - From ChurchCrunch.com&body=<?php the_permalink() ?>" title="Email this Post to a Friend!">Email Post</a>
Luke DeMoss says
Thanks so much for sharing these pieces of code with us! By sharing your expertise in this area, you are allowing us to all do things better!
chrissulli says
Are you literally putting them in the post html on every post or building it in so it is in every post?
human3rror says
every post. single.php in the loop.
chrissulli says
You win. I think today is the day I actually figure out how my blog works. Here goes nothing.
chrissulli says
And I broke it… but then I fixed it! This coding stuff is easy! errr….
Rich Schmidt says
Thanks, John! I'd already swiped your code after you pointed out your method for creating the Tweet this link. 🙂 Works like a charm!
Jim says
bahahaha~
Josh Wagner says
Thanks, John, for sharing your code. As I'm building my site it helps to see how the good ones code theirs! 😉
Brian Alexander says
it's not working right with my code. Can you give me some HTML/php help. I want it on the left side on the same line as the comments and catagories. It's not going there tough.