How to add custom code after post content?

If you want to insert code after post content(on  internal page), the best way to do it is to use special function. Add it in file functions.php of child theme or in plugin FunctionsPHP:

function functionsphp_after_content( $content ){
    // return if not single page
    if ( ! is_single() ) { 
        return $content;

    // write your HTML with scripts or blocks
    $my_html =  <<<EOT
<!-- my HTML code, for example with share buttons or advertising -->

    // call the function (it must return result rather than print it!)
    $some_function_result = get_my_recent_posts();  

    //Add all in the correct sequence after content
    return $content . $my_html . $some_function_result;
add_action('the_content', 'functionsphp_after_content' );