the_post();
    ?>

		<?php 
    $stacks = get_post_meta($post->ID, '_stack_builder_stacks', true);
    if (is_array($stacks)) {
        foreach ($stacks as $stack) {
            $stack['id'] = 'stack-' . $post->ID . '-' . $stack['stack_id'];
            if ($stack['template_id'] == 'page_content') {
                $stack['template_id'] = 'single_event';
                gen_stack($stack);
            } else {
                gen_stack($stack);
            }
        }
    } else {
        // In case no stack meta
        $stack = array('template_id' => 'single_event');
        $stack['id'] = 'stack-' . $post->ID;
        gen_stack($stack);
    }
    ?>

	<?php 
}
?>
	<div class="vspace-40"></div>
</div>

<?php 
get_footer();
function nt_add_custom_content_to_analysis($content, $post)
{
    if (is_admin()) {
        $stacks = get_post_meta($post->ID, '_stack_builder_stacks', true);
        if (is_array($stacks)) {
            ob_start();
            foreach ($stacks as $stack) {
                $stack['id'] = 'stack-' . $post->ID . '-' . $stack['stack_id'];
                if ($stack['template_id'] == 'page_content') {
                    $stack['template_id'] = 'page_content_full_width';
                    gen_stack($stack);
                } else {
                    gen_stack($stack);
                }
            }
            $content .= ob_get_contents();
            ob_end_clean();
        }
    } else {
        return false;
    }
    return $content;
}