<?php 
$post_id = edumodo_get_id();
$edumodo_learndash_course_style_2_widget_divider = edumodo_get_theme_mod('edumodo_single_ld_course_widget_divider_trigger', 'on');
$edumodo_learndash_course_style_2_update_time = edumodo_get_theme_mod('edumodo_single_ld_course_post_update_time', 'on');
$edumodo_learndash_course_style_2_tag = edumodo_get_theme_mod('edumodo_single_ld_course_post_tags_trigger', 'on');
$edumodo_learndash_course_style_2_releated_post = edumodo_get_theme_mod('edumodo_single_ld_course_related_course_trigger', 'on');
$edumodo_learndash_course_style_2_releated_post_style = edumodo_get_theme_mod('edumodo_single_ld_related_course_style', 'list');
$edumodo_learndash_course_style_2_releated_course_column = edumodo_get_theme_mod('edumodo_single_ld_related_course_column', '2');
$edumodo_learndash_course_style_2_releated_course_count = edumodo_get_theme_mod('edumodo_single_ld_related_course_per_page', 3);

?>

<?php
    while ( have_posts() ) : the_post();
        $img_category   = get_post_meta( get_the_ID(), '_edumodo_header_img', true ); 
        $enable_video   = get_post_meta( get_the_ID(), '_learndash_course_grid_enable_video_preview', true );
        $embed_code     = get_post_meta( get_the_ID(), '_learndash_course_grid_video_embed_code', true );
        $button_text    = get_post_meta( get_the_ID(), '_learndash_course_grid_custom_button_text', true );
        // Retrive oembed HTML if URL provided
        if ( preg_match( '/^http/', $embed_code ) ) {
            $embed_code = wp_oembed_get( $embed_code, array( 'height' => 600, 'width' => 400 ) );
        }
        $button_text = isset( $button_text ) && ! empty( $button_text ) ? $button_text : __( 'See more...', 'edumodo' );
        $button_text = apply_filters( 'learndash_course_grid_custom_button_text', $button_text, $post_id );
    ?>

<div class="container">
    <div class="row">
        <div class="lpcourse-course-wapper-3 ld-lpcourse-course-wapper ld-single-layout-2">
            <div class="lpcourse-main">
                <div class="col-md-8">
                    <div id="learn-press-course" class="course-summary ld-course-summary">
                        <?php the_content(); ?>
                    </div>
                    <?php if ( 'on' == $edumodo_learndash_course_style_2_releated_post ) {
                        edumodo_learndash_related_courses_grid($post_id, $edumodo_learndash_course_style_2_releated_course_column, $edumodo_learndash_course_style_2_releated_course_count); 
                    }
                ?>
                </div>

                <div class="col-md-4">

                    <div class="lpcourse-sidebar ldcourse-sidebar 
                    <?php echo 'on' == $edumodo_learndash_course_style_2_widget_divider ? 'sidebar-devider' : ''; ?>
                    <?php echo !has_post_thumbnail() ? 'hidden' : ''; ?>"
                    >
                        <div class="course-video">

                            <?php if (has_post_thumbnail()) : ?>
                                <figure class="post-thumbnail">
                                    <a href="<?php the_permalink(); ?>">
                                        <?php the_post_thumbnail();?>
                                    </a>
                                </figure>
                            <?php endif; ?>

                            <div class="lp-course-meta">
                                <div class="single-price">
                                    <div class="course-price">
                                        <div class="<?php echo esc_attr( $class ); ?>">
                                            <?php echo edumodo_learndash_course_ribbon_text($post_id); ?>
                                        </div>
                                    </div>
                                </div>

                                <div class="lp-course-buttons">
                                    <?php echo do_shortcode( '[learndash_payment_buttons course_id='.get_the_ID().']' ); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    <aside class="widget-area">
                        <?php dynamic_sidebar('ld-course-sidebar-1');?>
                    </aside>
                </div>

            </div>
        </div>
    </div>
</div><!-- .container -->

<?php endwhile; // End of the loop. ?>