<?php
/**
 * The template for displaying all STD templates.
 */

use Engine\Modules\Layouts\Engine_Single_Product;

$layout_type = get_post_meta(get_the_ID(), 'std_layout_type', true); ?>

<?php get_header(); ?>

<?php do_action('woocommerce_before_main_content'); ?>

<?php if ('single_product' === $layout_type) : ?>
    <div <?php wc_product_class(); ?>>
        <?php while (have_posts()) : ?>
            <?php the_post(); ?>
            <?php if (Engine_Single_Product::get_instance()::get_preview_product_id()) : ?>
                <?php the_content(); ?>
            <?php endif; ?>
        <?php endwhile; ?>
    </div>
<?php else : ?>
    <?php while (have_posts()) : ?>
        <?php the_post(); ?>
        <?php the_content(); ?>
    <?php endwhile; ?>
<?php endif; ?>

<?php do_action('woocommerce_after_main_content'); ?>

<?php get_footer(); ?>
