<?php
$portfolio_column_count=1;
$columns=4;
$portfolio_perpage=8;

// Get the number of columns set from theme options
$portfolio_layout=of_get_option('portfolio_achivelisting');
if ($portfolio_layout==1) { $portfolio_style="one"; $portfolioImage_type="portfolio-full"; }
if ($portfolio_layout==2) { $portfolio_style="two"; $portfolioImage_type="portfolio-large"; }
if ($portfolio_layout==3) { $portfolio_style="three"; $portfolioImage_type="portfolio-medium"; }
if ($portfolio_layout==4) { $portfolio_style="four"; $portfolioImage_type="portfolio-small"; }
?>
<?php $term = get_queried_object(); ?>
<div class="entry-title">
<h1><?php echo $term->name; ?></h1>
</div>

<div class="fullpage-contents-wrap">
	<div class="page-container">
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>


			<?php
				$portfolio_tags = wp_tag_cloud(array(
					'smallest'             => 10,                      // font size for the least used tag
					'largest'                => 10,                    // font size for the most used tag
					'unit'                      => 'px',                 // font sizing choice (pt, em, px, etc)
					'number'              => '',                 // maximum number of tags to show
					'format'                => 'list',            // flat, list, or array. flat = spaces between; list = in li tags; array = does not echo results, returns array
					'separator'          => '',                      //
					'orderby'              => '',           // name = alphabetical by name; count = by popularity
					'order'                   => 'DESC',          // starting from A, or starting from highest count
					'exclude'              => '',                      // ID's of tags to exclude, displays all except these
					'include'               => '',                      // ID's of tags to include, displays none except these
					'link'                       => 'view',             // view = links to tag view; edit = link to edit tag
					'taxonomy'         => 'tagportfolio'
				));
				echo $portfolio_tags;
			?>	
<div class="portfolio-taxonomies-browse clearfix">
<ul>
</ul>
</div>	
			
<div class="portfoliofilter-columns-wrap clearfix">
	<ul class="portfolio-<?php echo $portfolio_style; ?>">
		<?php

		global $query_string;
		query_posts($query_string . "&posts_per_page=-1");

		if (have_posts()) : while (have_posts()) : the_post();
		$custom = get_post_custom(get_the_ID());
		$portfolio_cats = get_the_terms( get_the_ID(), 'types' );
		$video_url="";
		$thumbnail="";
		$link_url="";
		if ( isset($custom["video"][0]) ) { $video_url=$custom["video"][0]; }
		if ( isset($custom["thumbnail"][0]) ) { $thumbnail=$custom["thumbnail"][0]; }
		if ( isset($custom["custom_link"][0]) ) { $link_url=$custom["custom_link"][0]; }
		$portfolio_thumb_header=$custom["portfolio_page_header"][0];
if ($portfolio_column_count>$columns) $portfolio_column_count=1;
?>
<li class="portfolio-col-<?php echo $portfolio_column_count++; ?>">

			<?php require ( MTHEME_INCLUDES . '/likes-comments.php' ); ?>
			
			<?php
			if ( $custom["video"][0]<>"" ) {
				$p_class="fadethumbnail-play";
			} elseif ( $custom["custom_link"][0]<>"" ) {
				$p_class="fadethumbnail-link";
			} else {
				$p_class="fadethumbnail-view";
			}
			?>
				<?php
				if ( $custom["video"][0]<>"" ) {
					echo activate_lightbox (
						$lightbox_type="prettyPhoto",
						$ID=$post->ID,
						$link=$video_url,
						$mediatype="video",
						$title=$post->post_title,
						$class="portfolio-image-link portfolio-columns",
						$navigation="prettyPhoto[portfolio]"
						);
					echo '<span class="column-portfolio-icon portfolio-video-icon"></span>';
					} elseif ( $custom["custom_link"][0]<>"" ) {
						echo '<a class="portfolio-image-link portfolio-columns" title="'.get_the_title().'" href="'.$custom["custom_link"][0].'" >';
						echo '<span class="column-portfolio-icon portfolio-link-icon"></span>';

					} else {
						echo activate_lightbox (
							$lightbox_type="prettyPhoto",
							$ID=$post->ID,
							$link=featured_image_link($post->ID),
							$mediatype="image",
							$title=$post->post_title,
							$class="portfolio-image-link portfolio-columns",
							$navigation="prettyPhoto[portfolio]"
							);
					echo '<span class="column-portfolio-icon portfolio-image-icon"></span>';
				}
				?>
				<?php
				// Show Image
				if ($thumbnail<>"") {
					echo '<img src="'.$thumbnail.'" class="preload-image displayed-image" alt="thumbnail" />';
				} else {
					echo display_post_image (
						$post->ID,
						$have_image_url="",
						$link=false,
						$type=$portfolioImage_type,
						$post->post_title,
						$class="preload-image displayed-image"
					);
				}
				?>		
				</a>
				<div class="work-details">
					<h4><a href="<?php if ($link_url<>"") { echo $link_url; } else { the_permalink(); } ?>" rel="bookmark" title="<?php echo get_the_title(); ?>"><?php the_title(); ?></a></h4>
					<p class="entry-content work-description"><?php echo $custom["description"][0];?></p>
				</div>
		</li>
		<?php endwhile; ?>
		<?php endif;?>
 
	</ul>
</div>
		
			<?php require ( MTHEME_INCLUDES . '/navigation.php' ); ?>

		</div>
	</div>
</div>