public function widget($args, $instance)
 {
     extract($args);
     $defaults = array('title' => '', 'type' => 'car', 'limit' => '3', 'description' => '');
     $instance = wp_parse_args((array) $instance, $defaults);
     $title = '';
     $html = '';
     // Create beautiful title
     if (isset($instance['title'])) {
         $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
         if (!empty($title)) {
             $title_array = explode(" ", $title);
             $title = "";
             foreach ($title_array as $tcount => $word) {
                 if ($tcount == 0) {
                     $word = "<strong>" . $word . "</strong>";
                 }
                 $title .= $word . " ";
             }
             $title = "<h2>" . $title . "</h2>";
         }
     }
     // echo '<div class="widget">';
     echo $before_widget;
     echo '<div class="tabs_widget tabs_wrapper section">';
     echo $title;
     echo '<ul class="tabs">';
     echo '<li class="current">' . __('Recent', AT_TEXTDOMAIN) . '</li>';
     echo '<li>' . __('Popular', AT_TEXTDOMAIN) . '</li>';
     echo '</ul>';
     // Render recent posts container
     echo '<div class="box visible" style="display: block;">';
     $recent_query = new WP_Query(array('showposts' => $instance['limit'], 'nopaging' => 0, 'post_type' => $instance['type'], 'orderby' => 'post_date', 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
     $i = 0;
     while ($recent_query->have_posts()) {
         $recent_query->the_post();
         echo '<div class="tab_post">';
         if (has_post_thumbnail()) {
             echo '<a href="' . esc_url(get_permalink()) . '" class="thumb">';
             the_post_thumbnail(array(57, 45));
             echo '</a>';
         }
         echo '<div class="desc">';
         echo '<a href="' . esc_url(get_permalink()) . '">' . AT_Common::trim_content(get_the_excerpt(), 40) . '</a>';
         echo '</div>';
         echo '</div>';
     }
     echo '</div>';
     // Render popular posts container
     echo '<div class="box" style="display: none;">';
     $popular_query = new WP_Query(array('showposts' => $instance['limit'], 'nopaging' => 0, 'post_type' => $instance['type'], 'orderby' => 'comment_count', 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
     $i = 0;
     while ($popular_query->have_posts()) {
         $popular_query->the_post();
         echo '<div class="tab_post">';
         if (has_post_thumbnail()) {
             echo '<a href="' . esc_url(get_permalink()) . '" class="thumb">';
             the_post_thumbnail(array(57, 45));
             echo '</a>';
         }
         echo '<div class="desc">';
         echo '<a href="' . esc_url(get_permalink()) . '">' . AT_Common::trim_content(get_the_excerpt(), 40) . '</a>';
         echo '</div>';
         echo '</div>';
     }
     echo '</div>';
     echo '</div>';
     // display description
     echo !empty($instance['description']) ? '<p><!-- WHITESPACE --></p><ul><p>' . $instance['description'] . '</p></ul>' : '';
     echo $after_widget;
     // echo '</div>';
 }