Skip to content

Instantly share code, notes, and snippets.

@frankschrijvers
Last active February 12, 2019 22:23
Show Gist options
  • Save frankschrijvers/798f0d61ddc85a25d0ce7683d20cb373 to your computer and use it in GitHub Desktop.
Save frankschrijvers/798f0d61ddc85a25d0ce7683d20cb373 to your computer and use it in GitHub Desktop.
Add Email This Option to Bottom of Post
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add Email This Option to Bottom of Post
add_filter( 'the_content', 'wps_add_email_this_button' );
function wps_add_email_this_button($content){
if (is_single()) {
$content .= '<a class="mail-btn" href="mailto:?subject=' . get_the_title() . '&amp;body=' . get_the_permalink() . '" title="Send this article to a friend!">Email this</a>';
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment