/**
         * Front-end display of widget.
         *
         * @see WP_Widget::widget()
         *
         * @param array $args     Widget arguments.
         * @param array $instance Saved values from database.
         */
        public function widget($args, $instance)
        {
            extract($args);
            $latest_review_posts_title = $instance['latest_review_post_title'];
            $latest_review_posts_type = $instance['latest_review_posts_type'];
            $latest_review_posts_count = $instance['latest_review_posts_count'];
            echo $before_widget;
            ?>
        <div class="latest-review-posts clearfix">
           <h1 class="widget-title"><span><?php 
            echo esc_attr($latest_review_posts_title);
            ?>
</span></h1>     
           <div class="review-posts-wrapper">
              <?php 
            $review_args = array('posts_per_page' => $latest_review_posts_count, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => 'product_review_option', 'meta_value' => $latest_review_posts_type, 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'post_status' => 'publish', 'suppress_filters' => true);
            $review_array = new WP_Query($review_args);
            $p_count = 0;
            if ($review_array->have_posts()) {
                while ($review_array->have_posts()) {
                    $review_array->the_post();
                    $p_count++;
                    $review_image_id = get_post_thumbnail_id();
                    $review_big_image_path = wp_get_attachment_image_src($review_image_id, 'accesspress-mag-block-big-thumb', true);
                    $review_small_image_path = wp_get_attachment_image_src($review_image_id, 'accesspress-mag-block-small-thumb', true);
                    $review_image_alt = get_post_meta($review_image_id, '_wp_attachment_image_alt', true);
                    $apmag_overlay_icon = of_get_option('apmag_overlay_icon', 'fa-external-link');
                    $post_format = get_post_format(get_the_ID());
                    if ($post_format == 'video') {
                        $post_format_icon = 'fa-video-camera';
                        $show_icon = 'on';
                    } elseif ($post_format == 'audio') {
                        $post_format_icon = 'fa-music';
                        $show_icon = 'on';
                    } elseif ($post_format == 'gallery') {
                        $post_format_icon = 'fa-picture-o';
                        $show_icon = 'on';
                    } else {
                        $show_icon = 'off';
                    }
                    if ($p_count == 1) {
                        ?>
                        <div class="single-review top-post non-zoomin clearfix">
                                <div class="post-image">
                                    <?php 
                        if (has_post_thumbnail()) {
                            ?>
                                    <img src="<?php 
                            echo $review_big_image_path[0];
                            ?>
" alt="<?php 
                            echo esc_attr($review_image_alt);
                            ?>
" />
                                    <?php 
                        } else {
                            ?>
                                    <img src="<?php 
                            echo get_template_directory_uri();
                            ?>
/images/no-image-medium.jpg" alt="<?php 
                            _e('No image', 'accesspress-mag');
                            ?>
" />
                                    <?php 
                        }
                        ?>
                                    <a class="big-image-overlay" href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
"><i class="fa <?php 
                        echo esc_attr($apmag_overlay_icon);
                        ?>
"></i></a>
                                    <?php 
                        if ($show_icon == 'on') {
                            ?>
<span class="format_icon"><i class="fa <?php 
                            echo esc_attr($post_format_icon);
                            ?>
"></i></span><?php 
                        }
                        ?>
                                </div>
                                
                                    <h3 class="post-title"><a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h3>
                                    <div class="ratings-wrapper"><?php 
                        do_action('accesspress_mag_post_review');
                        ?>
</div>
                            
                                <div class="block-poston"><?php 
                        do_action('accesspress_mag_home_posted_on');
                        ?>
</div>
                                <div class="post-content"><?php 
                        echo '<p>' . accesspress_word_count(get_the_content(), 25) . '</p>';
                        ?>
</div>
                        </div>
                    <?php 
                    } else {
                        ?>
                        <div class="single-review clearfix">
                                <div class="post-image">
                                    <a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        the_title();
                        ?>
">
                                        <?php 
                        if (has_post_thumbnail()) {
                            ?>
                                            <img src="<?php 
                            echo $review_small_image_path[0];
                            ?>
" alt="<?php 
                            echo esc_attr($review_image_alt);
                            ?>
" />
                                        <?php 
                        } else {
                            ?>
                                            <img src="<?php 
                            echo get_template_directory_uri();
                            ?>
/images/no-image-small.jpg" alt="<?php 
                            _e('No image', 'accesspress-mag');
                            ?>
" />
                                        <?php 
                        }
                        ?>
                                        <?php 
                        if ($show_icon == 'on') {
                            ?>
<span class="format_icon small"><i class="fa <?php 
                            echo esc_attr($post_format_icon);
                            ?>
"></i></span><?php 
                        }
                        ?>
                                    </a>
                                </div>
                                <div class="post-desc-wrapper">
                                    <h4 class="post-title"><a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h4>
                                    <div class="ratings-wrapper"><?php 
                        do_action('accesspress_mag_post_review');
                        ?>
</div>
                                    <div class="block-poston"><?php 
                        do_action('accesspress_mag_home_posted_on');
                        ?>
</div>
                                </div>
                        </div>
                    <?php 
                    }
                    ?>
                <?php 
                }
            }
            ?>
           </div> 
        </div>
        <?php 
            echo $after_widget;
        }
 function accesspress_mag_homepage_excerpt()
 {
     global $post;
     $excerpt_type = of_get_option('home_excerpt_type', ' ');
     $excerpt_length = of_get_option('home_excerpt_lenght', '30');
     $excerpt_content = get_the_content($post->ID);
     if ($excerpt_type == 'letters' && !empty($excerpt_type)) {
         $excerpt_content = accesspress_letter_count($excerpt_content, $excerpt_length);
     } else {
         $excerpt_content = accesspress_word_count($excerpt_content, $excerpt_length);
     }
     echo '<p>' . esc_html($excerpt_content) . '</p>';
 }