function integrate_discourse_topic($atts, $content = null)
{
    $a = shortcode_atts(array('topic_id' => '1', 'type' => 'subject'), $atts, 'discourse');
    $discourse_base_url = get_option('dti_discourse_base_url');
    $topic_data = get_discourse_data('topic', $a['topic_id']);
    $get_raw_content = $topic_data['post_stream']['posts'][0]['cooked'];
    $title = $topic_data['title'];
    $content = add_base_url_to_link_from_discourse($get_raw_content, $discourse_base_url);
    $author = $topic_data['details']['created_by']['username'];
    $author_data = get_discourse_data('user', $author);
    $author_info = $author_data['user'];
    $author_avatar = $discourse_base_url . str_replace('{size}', '240', $author_info['avatar_template']);
    if ($a['type'] == 'subject') {
        $template_url = 'templates/topic_subject.php';
    } elseif ($a['type'] == 'full') {
        $all_posts = $topic_data['post_stream']['posts'];
        $template_url = 'templates/full_topic.php';
    } elseif ($a['type'] == 'reverse-full') {
        $all_posts = array_reverse($topic_data['post_stream']['posts']);
        $template_url = 'templates/full_topic.php';
    } elseif ($a['type'] == 'author-info') {
        $template_url = 'templates/author_info.php';
    } else {
        echo 'wrong type it should be either "subject", "author-info" "full" or "reverse-full"';
    }
    require_once $template_url;
}
<div class="discourse-topic-integration">
  <h1><?php 
echo $title;
?>
</h1>

  <?php 
foreach ($all_posts as $post) {
    echo '<h3>' . $post['username'] . '</h3>';
    $content = add_base_url_to_link_from_discourse($post['cooked'], $discourse_base_url);
    echo $content;
    echo '<hr/>';
}
?>

  <?php 
echo '<a href="' . $discourse_base_url . '/t/' . $atts['topic_id'] . '">';
?>
 <button> Join this discussion</button> </a>
</div>