function widget($args, $instance)
 {
     global $post;
     /** defaults */
     $instance = wp_parse_args($instance, array('post_id' => '', 'title' => '', 'show_agent' => 0, 'show_number' => 1, 'orderby' => '', 'order' => ''));
     extract($args);
     $post_id = $instance['post_id'];
     $title = $instance['title'];
     $orderby = $instance['orderby'];
     $order = $instance['order'];
     $show_agent = $instance['show_agent'];
     $show_number = !empty($instance['show_number']) ? absint($instance['show_number']) : 1;
     echo $before_widget;
     if ($show_agent == 'show_all') {
         echo $before_title . apply_filters('widget_title', $title, $instance, $this->id_base) . $after_title;
         $query_args = array('post_type' => 'employee', 'posts_per_page' => -1, 'orderby' => $orderby, 'order' => $order);
     } elseif ($show_agent == 'show_random') {
         echo $before_title . apply_filters('widget_title', $title, $instance, $this->id_base) . $after_title;
         $query_args = array('post_type' => 'employee', 'posts_per_page' => $show_number, 'orderby' => 'rand', 'order' => $order);
     } elseif (!empty($instance['post_id'])) {
         $post_id = explode(',', $instance['post_id']);
         echo $before_title . apply_filters('widget_title', $title, $instance, $this->id_base) . $after_title;
         $query_args = array('post_type' => 'employee', 'p' => $post_id[0], 'posts_per_page' => 1, 'orderby' => $orderby, 'order' => $order);
     }
     query_posts($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             echo '<div ', post_class('widget-agent-wrap'), '>';
             echo '<a href="', get_permalink(), '">', get_the_post_thumbnail($post->ID, 'employee-thumbnail'), '</a>';
             printf('<div class="widget-agent-details"><a class="fn" href="%s">%s</a>', get_permalink(), get_the_title());
             echo impa_employee_archive_details();
             if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) {
                 $has_listings = impa_has_listings($post->ID);
                 if (!empty($has_listings)) {
                     echo '<p><a class="agent-listings-link" href="' . get_permalink() . '#agent-listings">View My Listings</a></p>';
                 }
             }
             echo '</div>';
             //echo impa_employee_social();
             echo '</div><!-- .widget-agent-wrap -->';
         }
     }
     wp_reset_query();
     echo $after_widget;
 }
function archive_employee_loop()
{
    $class = '';
    $i = 4;
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            // starting at 4
            if ($i == 4) {
                $class = 'first one-fourth agent-wrap';
                $i = 0;
            } else {
                $class = 'one-fourth agent-wrap';
            }
            //increase count by 1
            $i++;
            $post_id = get_the_id();
            $thumb_id = get_post_thumbnail_id();
            $thumb_url = wp_get_attachment_image_src($thumb_id, 'employee-thumbnail', true);
            ?>

	<div <?php 
            post_class($class);
            ?>
 itemscope itemtype="http://schema.org/Person">
	<?php 
            echo '<a href="' . get_permalink() . '"><img src="' . $thumb_url[0] . '" alt="' . get_the_title() . ' photo" class="attachment-employee-thumbnail wp-post-image" itemprop="image" /></a>';
            ?>
		<div class="agent-details vcard">
		<?php 
            printf('<p><a class="fn" href="%s" itemprop="name">%s</a></p>', get_permalink(), get_the_title());
            echo impa_employee_archive_details();
            if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) {
                $has_listings = impa_has_listings($post_id);
                if (!empty($has_listings)) {
                    echo '<p><a class="agent-listings-link" href="' . get_permalink() . '#agent-listings">View My Listings</a></p>';
                }
            }
            //echo impa_employee_social();
            ?>
		</div><!-- .agent-details -->
	</div> <!-- .agent-wrap -->

	<?php 
        }
        if (function_exists('equity')) {
            equity_posts_nav();
        } elseif (function_exists('genesis_init')) {
            genesis_posts_nav();
        } else {
            impress_agents_paging_nav();
        }
    } else {
        ?>

	<p><?php 
        _e('Sorry, no posts matched your criteria.');
        ?>
</p>
	<?php 
    }
}