<?php
/**
 * @version	$Id$
 * @package	IT_Theme_Framework
 * @author	 InnoThemes Team <support@innothemes.com>
 * @copyright  Copyright (C) 2012 InnoThemes.com. All Rights Reserved.
 * @license	GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.innothemes.com
 */

$loop = new WP_query(
	array(
		'post_type'      => 'member',
		'posts_per_page' => -1,
		'orderby'        => 'ASC'
	)
);

$count       = 0;
$arr_content = array();
while( $loop->have_posts() ) :
	$loop->the_post();
$count++;

$url 	= get_post_meta($post->ID, "url", true);
$urlimg	= get_post_meta($post->ID, 'urlimg', true);
$str 	= '';

if( $url != '' ) {
	$str .= '<li><p class="icon"><a class="avatar" href="' . $urlimg . '"><img src="' . $url . '" />';
	$str .= '</a>';
	$str .= get_the_title();
	$str .= '</p></li>';
} else {
	$str .= '<li><p class="icon"><a class="avatar" href="' . $urlimg . '">';
	$str .= get_the_post_thumbnail( $page->ID, 'thumbnail' );
	$str .= '</a>';
	$str .= get_the_title();
	$str .= '</p></li>';
}
$arr_content[] = $str;

endwhile;  wp_reset_query();
if( $count ): ?>

<h3 class="it-title"><?php _e( 'Meet Our Team', IT_THMFW_TEXTDOMAIN ); ?></h3>
<div class="it-separate"></div>

<script src="<?php echo IT_THEME_URI . '/assets/3rd-party/horizontal-scroll/horizontalScroll.js' ?>"></script>
<script>
	if ( jQuery !== 'undefined') jQuery.noConflict();
	!function ($) {
		$().ready(function() {
			$('#it-team-member').horizontalScroll();
		});
	}(jQuery);
</script>

<div id="it-team-member">
	<ul id="child" class="it-member">
		<?php echo implode( "", $arr_content ); ?>
	</ul><!--End ul#child .it-member-->
</div><!--End div.it-team-member-->
<div id="scrollbar">
	<div id="track">
		<div id="dragBar" style="left: 1px; top: 1px; width: 480px;"></div>
	</div><!--End div#track-->
</div><!--End div#scrollbar-->
<?php endif;?>