Skip to content

Instantly share code, notes, and snippets.

@pvphong90
Last active December 8, 2017 08:29
Show Gist options
  • Save pvphong90/06cd7ba843add14a4f12f1c39b7e71fc to your computer and use it in GitHub Desktop.
Save pvphong90/06cd7ba843add14a4f12f1c39b7e71fc to your computer and use it in GitHub Desktop.
add_filter( 'the_content', 'add_related_post' );
function add_related_post( $content ) {
$related_posts= "<div class='meta-related'>".do_shortcode('[related_posts]')."</div>";
if ( is_single() ) {
return count_p( $related_posts, 2, $content );
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment