    <?php
        use Elementor\Group_Control_Image_Size;

        $settings = $this->get_settings();

        $excerpt_toggle = $settings['excerpt_toggle'];
        $excerpt_desc_word = $settings['excerpt_desc_word'];
        $read_more_button = $settings['read_more_button'];
        $read_more_button_custom_text = $settings['course_custom_button_text'];
        // $cat_multi_slug = widgetkit_pro_array_get($settings, 'cat_dynamic_multiple_id');
        $post_num_to_show = widgetkit_pro_array_get($settings, 'post_num_to_show');
        $orderby = widgetkit_pro_array_get($settings, 'orderby');
        $order = widgetkit_pro_array_get($settings, 'order');
        $thumb_size = widgetkit_pro_array_get($settings, 'image_size');
    ?>

    <?php if (class_exists('Tribe__Events__Main')) : ?>
        <div class="widgetkit-event-list widgetkit-event-list-element">
            <div class="column-grid">
                <?php
                /**
                 * Query for the post
                 * custom post type
                 * post type : tribe_events
                 */
                $event_query_args = array(
                    'post_type' => 'tribe_events',
                    'posts_per_page' => $post_num_to_show,
                    'orderby' => $orderby,
                    'order' => $order,
                );  
                

                $event_query = new WP_Query($event_query_args);
                if ($event_query->have_posts()):
                    while ($event_query->have_posts()):
                        $event_query->the_post();
                            $event_excerpt = get_the_excerpt(get_the_ID());
                            $read_more_text = $read_more_button_custom_text ? $read_more_button_custom_text : esc_html('Read More', 'Widgetkit-pro');
                        ?>

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

                                <?php if(has_post_thumbnail()): ?>
                                    <a href="<?php the_permalink();?>">
                                        <img src="<?php echo Group_Control_Image_Size::get_attachment_image_src(get_post_thumbnail_id(), 'image', $settings );?>" alt="<?php the_title(); ?>">
                                    </a>
                                <?php endif; ?>
                                

                                <div class="content">
                                    <div class="meta-data <?php echo tribe_has_venue(get_the_ID()) ? '' : 'grid-1'; ?>">
                                        <span class="event-date">
                                            <i class="fa fa-calendar"></i>
                                            <?php echo tribe_get_start_date(); ?>
                                        </span>
                                        <?php if(tribe_has_venue(get_the_ID())): ?>
                                            <span class="event-venue">
                                                <i class="fa fa-map-marker"></i>
                                                <?php echo tribe_get_city( get_the_ID() ); ?>
                                            </span>
                                        <?php endif; ?>
                                    </div>

                                    <a href="<?php the_permalink();?>">
                                        <h3 class="wk-entry-title">
                                            <?php esc_html_e(get_the_title(), 'widgetkit-pro');?>
                                        </h3>
                                    </a>

                                    <?php if($excerpt_toggle): ?>
                                        <p class="event-excerpt">
                                            <?php echo wp_trim_words( $event_excerpt, $excerpt_desc_word, '' ); ?>
                                        </p>
                                    <?php endif; ?>

                                    <?php if($read_more_button): ?>
                                        <a class="read-more" href="<?php the_permalink(); ?>">
                                            <?php echo $read_more_text;?>
                                            <i class="fa fa-long-arrow-right"></i>
                                        </a>
                                    <?php endif; ?>
                                </div><!-- .entry-header -->
                            </article><!-- #post-## -->

                        </div>

                    <?php 
                    endwhile; 
                    wp_reset_postdata(); 
                    wp_reset_query(); 
                endif;?>
            </div>
        </div>

    <?php else:  ?>
        <div class="plugin-active-massage">
            <h3><?php esc_html_e('Please activate LearnDash LMS plugin first', 'widgetkit-pro');?></h3>
        </div>
    <?php endif;  ?>
