<?php
/**
 * The template for displaying learndash single page
 *
 * @package edumodo
 */

$post_id = edumodo_get_id();
$prefix = '_edumodo_';
setPostViews(get_the_ID());

$title_enable = get_post_meta($post_id, $prefix . 'title_enable', true);
$lifter_single_layout_select = get_theme_mod('edumodo_single_lifter_course_layout','1');
// enable social share
$enable_lifter_single_social  = get_theme_mod('edumodo_single_lifter_course_social_trigger','on');
// enable related course
$enable_lifter_single_related_courses   = get_theme_mod('edumodo_single_lifter_course_related_course_trigger','on');
// enable post tags
$enable_lifter_single_post_tags  = get_theme_mod('edumodo_single_lifter_course_post_tags_trigger','on');
// sidebar control
$edumodo_lifter_lesson_layout  = get_theme_mod('edumodo_lifter_lesson_layout','right-sidebar');

get_header();?>

	<div id="primary" class="content-area lifter-conent-area">
		<main id="main" class="site-main">
            <?php do_action('edumodo-lifter-header-title-breadcrumb'); ?>
			<div class="container">
                <div class="row">
                    <?php if('left-sidebar' == $edumodo_lifter_lesson_layout): ?>
                        <div class="col-md-4">
                            <?php dynamic_sidebar('llms_lesson_widgets_side'); ?>
                        </div>
                    <?php endif; ?>
                    <div class="col-md-<?php echo 'no-sidebar'  == $edumodo_lifter_lesson_layout ? '12' : '8'; ?> content-wrapper">
                        <?php
                        while ( have_posts() ) : the_post(); ?>

                            <div id="post-<?php the_ID(); ?>" <?php post_class('single-post'); ?>>

                                <?php if( has_post_thumbnail() ): ?>
                                    <figure class="post-thumbnail">
                                        <?php the_post_thumbnail(); ?>
                                        <?php if(is_sticky()): ?>
                                            <div class="post-triangle">
                                                <span>
                                                    <i class="fas fa-star"></i>
                                                </span>
                                            </div>
                                        <?php endif; ?>
                                    </figure> <!-- End All Post Formate -->
                                <?php endif; ?>

                                <h2 class="title entry-title lesson-title"> <?php echo get_the_title(get_the_ID());?> </h2>

                                <div class="entry-content">
                                    <?php the_content();
                                        wp_link_pages( array(
                                            'before'      => '<div class="page-links">' . esc_html__( 'Pages:', 'edumodo' ),
                                            'after'       => '</div>',
                                            'next_or_number'   => 'number',
                                            'link_before' => '<span class="page-number">',
                                            'link_after'  => '</span>',
                                        ) );
                                    ?>
                                </div>

                                <footer class="entry-footer-body">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <?php if( $enable_lifter_single_post_tags == 'on' ): ?>
                                                <div class="post-meta pull-left">
                                                    <?php if(has_tag()):?>
                                                        <!-- Post tag -->
                                                        <span class="post-tags-title"><?php esc_html_e( 'Tags:', 'edumodo' ); ?></span>
                                                        <span class="post-tags"><?php the_tags('', ', ', '<br />'); ?></span>
                                                    <?php endif;?>
                                                </div>
                                            <?php endif;?>

                                            <div class="edit">
                                                <?php
                                                    edit_post_link(
                                                        sprintf(
                                                            /* translators: %s: Name of current post */
                                                            esc_html__( 'Edit %s', 'edumodo' ),
                                                            the_title( '<span class="screen-reader-text">"', '"</span>', false )
                                                        ),
                                                        '<span class="edit-link">',
                                                        '</span>'
                                                    );
                                                ?>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="social-share-wrapper text-md-right">
                                                <?php if( $enable_lifter_single_social == 'on' ): ?>
                                                    <?php echo edumodo_social_share(); ?>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                    </div>
                                </footer> <!-- .entry-footer-body -->
                            </div><!-- #post-## -->

                        <?php endwhile; // End of the loop.?>
                    </div>
                    <?php if('right-sidebar' == $edumodo_lifter_lesson_layout): ?>
                        <div class="col-md-4">
                            <?php dynamic_sidebar('llms_lesson_widgets_side'); ?>
                        </div>
                    <?php endif; ?>
                </div><!-- .row -->
            </div><!-- .container -->

		</main><!-- #main -->
	</div><!-- #primary -->

<?php
get_footer();
