Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neverything/83cfe1c0586f24fa5b812fdafb465f68 to your computer and use it in GitHub Desktop.
Save neverything/83cfe1c0586f24fa5b812fdafb465f68 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'generate_post_author_output', function( $output ) {
if ( is_singular( 'post' ) ) {
$current_id = get_the_ID();
$social_links = [];
// Add opening div
$social_links[] = '<div class="social-sharing">';
// Intro Text
$social_links[] = '<span>Artikel teilen: </span>';
// E-Mail
$social_links[] = '<a class="email" href="mailto:?subject=Spannender Artikel für dich: ' . get_the_title( $current_id ) . '&amp;body=Schau mal ' . get_permalink( $current_id ) . '">E-Mail Icon</a>';
// Facebook
$social_links[] = '<a class="facebook" href="<a href="https://www.facebook.com/sharer/sharer.php?u=' . get_permalink( $current_id ) . '">FB Icon</a>';
// Twitter
$social_links[] = '<a class="twitter" href="https://twitter.com/home?status=' . get_the_title( $current_id ) . ' ' . get_permalink( $current_id ) . '">Twitter Icon</a>';
// Add closing div
$social_links[] = '</div>';
// Glue the original output with our custom links.
$output = $output . implode( $social_links );
}
// Always return the ouput, because it's a filter.
return $output;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment