Hi there,

I am using the code below to insert content in the middle of a single article on my blog. The website is designed in PHP and the function that calls the related articles is
Code PHP:
<?php related_posts() ?>

This is the code that I am using to insert it in the middle of a post.


Code PHP:
function inject_ad_text_after_n_chars($content) {
  // only do this if post is longer than 1000 characters
  $enable_length = 3000;
  // insert after the first </p> after 500 characters
  $after_character = 1500;
  if (is_single() && strlen($content) > $enable_length) {
    $before_content = substr($content, 0, $after_character);
    $after_content = substr($content, $after_character);
    $after_content = explode('</p>', $after_content);
    $text = '[B]Related Posts Function Goes Here[/B] ';
    array_splice($after_content, 1, 0, $text);
    $after_content = implode('</p>', $after_content);
    return $before_content . $after_content;
  }
  else {
    return $content;
  }
}
add_filter('the_content', 'inject_ad_text_after_n_chars');

I just need somebody to tell me how to translate my function <?php related_posts() ?> and put it in the line I have indicated above where it says "Related Posts Function Goes Here."

Any help would be appreciated.

Thanks.