I think you have two options on how to use the functions you’ve found. The first one is to add one of the functions to your single post template file.
pew_related(
array(), // add custom parameter key=>value pairs, if needed
get_the_ID(),
'' // not sure what is the purpose of the third parameter
);
or
$related_posts = exe_get_related_posts_by_common_terms( get_the_ID(), 3, 'post_tag', 'post' );
if ( $related_posts ) {
// foreach loop the $related_posts array for desired html output
}
The second option is to hook one of functions to suitable action or filter. For example,
// functions.php
add_filter( 'the_content', function($content){
if ( ! is_singular( 'post' ) ) {
return $content;
}
ob_start(); // push html output to buffer
pew_related(
array(), // add custom parameter key=>value pairs, if needed
get_the_ID(),
'' // not sure what is the purpose of the third parameter
);
$related_html = ob_get_clean(); // get buffer content
return $related_html ? $content . $related_html : $content; // concat html to post content
} );