function widget($atts, $instance)
    {
        extract($atts, EXTR_SKIP);
        echo $before_widget;
        $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
        $number_of_posts = empty($instance['number_of_posts']) ? '' : $instance['number_of_posts'];
        if (!empty($title)) {
            echo $before_title . $title . $after_title;
        }
        ?>

        <div class="tabbable tabs-top style_1">

        <ul class="nav nav-tabs">

                            <li class="active"><a href="#recent" data-toggle="tab">Recent</a></li>

                            <li class=""><a href="#popular" data-toggle="tab">Popular</a></li>


        </ul>



        <div class="tab-content">

                            <div class="tab-pane active" id="recent">

                                

                            	<?php 
        query_posts('showposts=' . $number_of_posts . '&orderby=date&order=desc');
        while (have_posts()) {
            the_post();
            ?>

						            <dl>

                                      <dt>
                                      <?php 
            the_post_thumbnail(array(60, 60));
            ?>
                                      </dt>

	                                    <dd>

	                                        <div class="title"><a href="<?php 
            echo get_permalink();
            ?>
"><?php 
            echo themeple_text_limit(get_the_title(), 5);
            ?>
</a></div>

	                                        <span><?php 
            echo get_the_date();
            ?>
, by <?php 
            echo get_the_author();
            ?>

	                                    </dd>

                                	</dl>

						        	<?php 
        }
        ?>

                            </div>

                            <div class="tab-pane" id="popular">

                                <?php 
        query_posts('showposts=' . $number_of_posts . '&orderby=comment_count&order=desc');
        while (have_posts()) {
            the_post();
            ?>

						            <dl>
                                     
                                     <dt>
                                      <?php 
            the_post_thumbnail(array(60, 60));
            ?>
                                      </dt>
                                    
                                    	<dd> 
                                            <div class="img"><img src=""
	                                        <div class="title"><a href="<?php 
            echo get_permalink();
            ?>
"><?php 
            echo themeple_text_limit(get_the_title(), 5);
            ?>
</a></div>

	                                        <span><?php 
            echo get_the_date();
            ?>
, by <?php 
            echo get_the_author();
            ?>

	                                    </dd>

                                	</dl>

						        	<?php 
        }
        ?>

                            </div>

                   

        </div>

     </div>  

        <?php 
        echo $after_widget;
    }
 function staff($element)
 {
     extract($element['saved'][0]);
     $output = '';
     if (isset($staff)) {
         $output .= '<div class="span' . $dynamic_size . '">';
         $query_post = array('p' => $staff, 'posts_per_page' => 1, 'post_type' => 'staff');
         $additional_loop = new WP_Query($query_post);
         if ($additional_loop->have_posts()) {
             while ($additional_loop->have_posts()) {
                 $additional_loop->the_post();
                 $content = get_the_content();
                 $featured = themeple_image_by_id(get_post_thumbnail_id(), array('width' => 1000, 'height' => 1000), 'url');
                 $staff_position = themeple_post_meta(get_the_ID(), 'staff_position_');
                 $output .= '<div class="one-staff">';
                 $output .= '<img src="' . $featured . '" alt="">';
                 $cl = '';
                 if ($with_desc == 'no') {
                     $cl = 'paa';
                 }
                 $output .= '<div class="content ' . $cl . '"><h4>' . get_the_title() . '</h4>';
                 $output .= '<span class="position">' . $staff_position . '</span>';
                 if ($with_desc == 'yes') {
                     if ($dynamic_size >= 4) {
                         $lim = 25;
                     } else {
                         $lim = 10;
                     }
                     $output .= '<p>' . themeple_text_limit(get_the_excerpt(), $lim) . '</p>';
                 }
                 $output .= '<div class="social_widget">';
                 $output .= '<ul>';
                 if (themeple_post_meta(get_the_ID(), 'facebook_link') != '') {
                     $output .= '<li class="facebook"><a href="' . themeple_post_meta(get_the_ID(), 'facebook_link') . '" title="Facebook"><i class="moon-facebook"></i></a></li>';
                 }
                 if (themeple_post_meta(get_the_ID(), 'twitter_link') != '') {
                     $output .= '<li class="twitter"><a href="' . themeple_post_meta(get_the_ID(), 'twitter_link') . '" title="Twitter"><i class="moon-twitter"></i></a></li>';
                 }
                 if (themeple_post_meta(get_the_ID(), 'google_link') != '') {
                     $output .= '<li class="google"><a href="' . themeple_post_meta(get_the_ID(), 'google_link') . '" title="Google"><i class="moon-google_plus"></i></a></li>';
                 }
                 if (themeple_post_meta(get_the_ID(), 'pinterest_link') != '') {
                     $output .= '<li class="pinterest"><a href="' . themeple_post_meta(get_the_ID(), 'pinterest_link') . '" title="Pinterest"><i class="moon-pinterest"></i></a></li>';
                 }
                 if (themeple_post_meta(get_the_ID(), 'linkedin_link') != '') {
                     $output .= '<li class="linkedin"><a href="' . themeple_post_meta(get_the_ID(), 'linkedin_link') . '" title="Linkedin"><i class="moon-linkedin"></i></a></li>';
                 }
                 if (themeple_post_meta(get_the_ID(), 'mail_link') != '') {
                     $output .= '<li class="main"><a href="mailto:' . themeple_post_meta(get_the_ID(), 'mail_link') . '" title="Facebook"><i class="moon-mail"></i></a></li>';
                 }
                 $output .= '</ul>';
                 $output .= '</div>';
                 $output .= '</div>';
                 $output .= '</div>';
             }
         }
         $output .= '</div>';
         wp_reset_query();
     }
     return $output;
 }
                    if (isset($themeple_config['dynamic_portfolio']['show_desc_bool']) && $themeple_config['dynamic_portfolio']['show_desc_bool']) {
                        ?>
                                        <div class="show_text">
                                            <h4><a href="<?php 
                        echo get_permalink();
                        ?>
"><?php 
                        echo get_the_title();
                        ?>
</a></h4>
                                            <span class="cat"><?php 
                        echo $sort_classes;
                        ?>
</span>
                                            <p><?php 
                        echo themeple_text_limit(get_the_excerpt(), 12);
                        ?>
</p>
                                        </div>
                                     <?php 
                    }
                    ?>
       
                                        
                                           
                        </div>

            <?php 
                }
            }
        }
/**
 * themeple_box_title()
 * 
 * @param mixed $text
 * @param mixed $width
 * @return
 */
function themeple_box_title($text, $width)
{
    if ($width == 2) {
        return themeple_text_limit($text, 2);
    }
    if ($width == 3) {
        return themeple_text_limit($text, 3);
    } else {
        if ($width == 4) {
            return themeple_text_limit($text, 5);
        } else {
            if ($width == 6) {
                return themeple_text_limit($text, 7);
            }
        }
    }
    if ($width == 8 || $width == 9) {
        return themeple_text_limit($text, 10);
    }
}