Skip to content

Instantly share code, notes, and snippets.

@joedolson
Created May 23, 2015 17:01
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 joedolson/9cd4f936b3833c9b0004 to your computer and use it in GitHub Desktop.
Save joedolson/9cd4f936b3833c9b0004 to your computer and use it in GitHub Desktop.
It hardly matters what else we do if this doesn't show up on the page! Use the power of filters and 'the_content' to get crucial data.
/*
* Use WordPress filter 'the_content' to add sharing links into post content.
*
* @param $content The current content of the post.
*
* @return $content The previous content of the post plus social sharing links.
*/
add_filter( 'the_content', 'id24_post_content' );
function id24_post_content( $content ) {
global $post;
$post_ID = $post->ID;
if ( is_main_query() && in_the_loop() ) {
$id24_social = id24_social_block( $post_ID );
$content = $content . $id24_social;
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment