Skip to content

Instantly share code, notes, and snippets.

@gthayer
Last active December 15, 2017 21:05
Show Gist options
  • Save gthayer/c2588245ccc3df7181090d69e3f3ba90 to your computer and use it in GitHub Desktop.
Save gthayer/c2588245ccc3df7181090d69e3f3ba90 to your computer and use it in GitHub Desktop.
add_filter( 'gform_confirmation_12', 'social_share', 10, 4 );
function social_share( $confirmation, $form, $entry, $is_ajax ) {
global $post;
$page = get_permalink();
$facebook_og = get_post_meta( $post->ID, '_yoast_wpseo_opengraph-description', true );
$twitter = get_post_meta( $post->ID, '_yoast_wpseo_twitter-description', true );
$confirmation .= '<div class="social-share">';
$confirmation .= '<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=' . $page . '"><i class="fa fa-facebook" aria-hidden="true"></i></a>';
$confirmation .= '<a target="_blank" href="http://twitter.com/home?status=' . urlencode( $twitter ) . ' ' . $page . '"><i class="fa fa-twitter" aria-hidden="true"></i></a>';
$confirmation .= '<a target="_blank" href="mailto:?subject=' . $post->post_title . '&body=' . $facebook_og . '"><i class="fa fa-envelope" aria-hidden="true"></i></a>';
$confirmation .= '</div>';
return $confirmation;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment