update portfolio
authorymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 11:14:17 +0000
changeset 6 490d5cc509ed
parent 5 5e2f62d02dcd
child 7 cf61fcea0001
update portfolio
wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio-post.php
wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio.php
--- a/wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio-post.php	Tue Jun 09 03:35:32 2015 +0200
+++ b/wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio-post.php	Tue Jun 09 11:14:17 2015 +0000
@@ -1,149 +1,208 @@
-<script src="<?php echo get_template_directory_uri(); ?>/js/scriptPortfolio.js" type="text/javascript"></script>
-
-<script type="text/javascript">
-	jQuery(document).ready(function(){
-		jQuery("a#example1").fancybox();
-	}); 
-	
-</script>
-<?php
-
-if ( have_posts() ) while ( have_posts() ) : the_post();
-
-   	$portfolioType = get_post_meta($post->ID, 'portfolio_type_selected' , true); 
-	$portfolioDate = get_post_meta($post->ID, 'portfolio_date' , true); 
-	$portfolioClient = get_post_meta($post->ID, 'portfolio_client' , true); 
-	$portfolioURL = get_post_meta($post->ID, 'portfolio_url' , true);
-	$portfolioABSTRACT = get_post_meta($post->ID, 'portfolio_abstract' , true);
-	$portfolioEMBED = get_post_meta($post->ID, 'portfolio_embed' , true);
-	$portfolioTWITTER = get_post_meta($post->ID, 'portfolio_twitter' , true);
-
-?>
-<div class="item-desc fl">					
-					<a href="" class="ajax-back" onclick="return backToPorfolios();"><span><?php _e('menu','pego_tr'); ?></span></a>
-					
-					<h2><?php  the_title(); ?></h2>
-					<?php
-						$terms = get_the_term_list( $post->ID,'portfolio_categories', '', ', ');
-						$terms = strip_tags( $terms );
-					?>
-					<p><?php echo $terms; ?></p>
-					<div class="dotted-line"></div>
-					<!--p class="item-text"--><?php /*echo get_the_content();*/ ?><!--/p-->
-					<p class="portfolio-post" style="font-family: 'Lato', arial, serif; color: #1b1b1b; line-height: 1.6; font-size: 14px; font-style: normal; text-align: justify;"><?php echo get_the_content(); ?></p>
-					<?php					
-					if (!empty($portfolioURL))
-					{
-						?>
-					<div class="url-stuff fl" style="margin-top: 0;margin-right:5px;">
-						<a href="<?php echo $portfolioURL; ?>" target="_blank">Controverse</a>
-					</div>
-					<?php 
-					}
-					?>
-					<?php					
-					if (!empty($portfolioABSTRACT))
-					{
-						?>
-					<div class="url-stuff fl" style="margin-top: 0;margin-right:5px;">
-						<a href="<?php echo $portfolioABSTRACT; ?>" target="_blank">Abstract</a>
-					</div>
-					<?php 
-					}
-					?>
-					<?php					
-					if (!empty($portfolioClient))
-					{
-						?>
-					<div class="url-stuff fl" style="margin-top: 0;margin-right:5px;margin-bottom:10px;">
-						<a href="<?php echo $portfolioClient; ?>" target="_blank">Site de l'intervenant</a>
-						
-					</div>
-					<?php 
-					}
-					?>
-
-
-					<?php					
-					if (!empty($portfolioTWITTER))
-					{
-					?>
-					<div class="url-stuff fl" style="margin-top: 10px;margin-right:5px;margin-bottom:10px; width:100%;">
-						<a href="https://twitter.com/<?php echo $portfolioTWITTER; ?>" target="_blank">@<?php echo $portfolioTWITTER; ?></a>
-					</div>
-					<?php 
-					}
-					?>
-
-					<?php					
-					if (!empty($portfolioEMBED))
-					{
-					?>
-					<div class="url-stuff fl" style="margin-top: 10px;margin-right:5px;margin-bottom:10px; width:100%;">
-						<?php echo $portfolioEMBED; ?>
-					</div>
-					<?php 
-					}
-					?>
-
-
-
-				</div>
-				
-	  <div class="col-570 fl">
-	  <?php
-		
-		if($portfolioType == 'Image') 			
-		{
-			$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
-			?>
-			<a id="example1" class="lightbox-image mw570"  href="<?php echo $image[0]; ?>"><img src="<?php echo $image[0]; ?>"  alt="" /></a>
-			<?php					
-		}
-		// end if image
-	    
-	   //video portfolio
-	   if($portfolioType == 'Video') 		
-		{
-	 		$video_url= get_post_meta($post->ID, 'portfolio_video_url' , true);   
-	 		if(!empty($video_url)) 
-	 		{
-	 			echo '<figure>'.$video_url.'</figure>';
-	 		}						
-	 	}
-	 	// end if video
-	 	
-	   //slideshow portfolio
-	if($portfolioType == 'Slideshow') 		
-		{	
-				$attachments = get_children(array('post_parent' => $post->ID,
-					                        'post_status' => 'inherit',
-				                           'post_type' => 'attachment',
-					                        'post_mime_type' => 'image',
-					                        'order' => 'ASC',
-					                        'orderby' => 'menu_order ID'));
-											
-																				
-					 		
-									echo '<div id="slides1">';
-									echo '<div class="slides_container">';
-									
-									foreach($attachments as $att_id => $attachment) {
-										$full_img_url = wp_get_attachment_url($attachment->ID);
-										echo '<div class="slide">';
-										?>
-										<a href="#"><img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo get_image_path($full_img_url); ?>&h=320&w=570&zc=1" title="" alt=""></a>
-										<?php
-										echo '</div>';
-								} //end foreach
-								echo '</div>';
-								echo '</div>';									
-	 	}
- 	?>
-				</div>
-				<div class="clearfix"></div>             
-<?php
-endwhile;
-?>    
-
-                    
+<?php
+/*
+* Template - Portfolio post
+* Version: 1.3
+*/
+get_header(); ?>
+	<div class="content-area">
+		<div id="container" class="site-content site-main">
+			<div id="content" class="hentry">
+				<div class="breadcrumbs home_page_title entry-header">
+					<?php global $post;
+					$title = get_the_title();
+					echo empty( $title ) ? '(' . __( 'No title', 'portfolio-pro' ) . ')' : $title; ?>
+				</div>
+				<?php $pdfprnt_options = get_option('pdfprnt_options_array');
+				if ( empty( $pdfprnt_options ) )
+					$pdfprnt_options = get_option('pdfprntpr_options_array');
+				if (  isset( $pdfprnt_options ) && is_array( $pdfprnt_options ) && true === in_array( 'portfolio', $pdfprnt_options['use_types_posts'] ) ) {
+					if ( function_exists( 'pdfprnt_show_buttons_for_bws_portfolio_post' ) )
+						echo pdfprnt_show_buttons_for_bws_portfolio_post();
+					elseif ( function_exists( 'pdfprntpr_show_buttons_for_bws_portfolio_post' ) )
+						echo pdfprntpr_show_buttons_for_bws_portfolio_post();
+				}
+				
+				global $wp_query;
+				while ( have_posts() ) : the_post(); ?>
+					<div class="portfolio_content entry-content">
+						<div class="entry">
+							<?php global $post;
+							$portfolio_options	=	get_option( 'prtfl_options' );
+							$meta_values		=	get_post_custom( $post->ID );
+							$post_thumbnail_id	=	get_post_thumbnail_id( $post->ID );
+							if ( empty ( $post_thumbnail_id ) ) {
+								$args = array(
+									'post_parent'		=>	$post->ID,
+									'post_type'			=>	'attachment',
+									'post_mime_type'	=>	'image',
+									'orderby'			=>	'menu_order',
+									'order'				=>	'ASC',
+									'numberposts'		=>	1
+								);
+								$attachments		=	get_children( $args );
+								$post_thumbnail_id	=	key($attachments);
+							}
+							$image			=	wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
+							$image_large	=	wp_get_attachment_image_src( $post_thumbnail_id, 'large' );
+							$image_alt		=	get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
+							$image_desc 	=	get_post($post_thumbnail_id);
+							$image_desc		=	$image_desc->post_content;
+							$full_descr     =   $post->post_content != "" ? $post->post_content : '';
+							$post_meta		=	get_post_meta( $post->ID, 'prtfl_information', true );
+							$date_compl		=	isset( $post_meta['_prtfl_date_compl'] ) ? $post_meta['_prtfl_date_compl'] : '';
+							if ( ! empty( $date_compl ) && 'in progress' != $date_compl) {
+								$date_compl		=	explode( "/", $date_compl );
+								$date_compl		=	date( get_option( 'date_format' ), strtotime( $date_compl[1] . "-" . $date_compl[0] . '-' . $date_compl[2] ) );
+							}
+							$link			=	isset( $post_meta['_prtfl_link'] ) ? $post_meta['_prtfl_link'] : '';
+							if ( empty( $full_descr ) )
+								$full_descr =   isset( $post_meta['_prtfl_short_descr'] ) ? $post_meta['_prtfl_short_descr'] : '';
+							$svn			=	$post_meta['_prtfl_svn']; 
+							if ( ! empty( $image[0] ) ) { ?>
+								<div class="portfolio_thumb">
+									<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>">
+										<img src="<?php echo $image[0]; ?>" width="<?php echo $portfolio_options['prtfl_custom_size_px'][0][0]; ?>" height="<?php echo $portfolio_options['prtfl_custom_size_px'][0][1]; ?>" alt="<?php echo $image_alt; ?>" />
+									</a>
+								</div><!-- .portfolio_thumb -->
+							<?php } ?>
+							<div class="portfolio_short_content">
+								<?php if ( 1 == $portfolio_options['prtfl_date_additional_field'] ) { ?>
+										<p>
+											<span class="lable"><?php echo $portfolio_options['prtfl_date_text_field']; ?></span> <?php echo $date_compl; ?>
+										</p>
+								<?php }
+								$user_id = get_current_user_id();
+								if ( 1 == $portfolio_options['prtfl_link_additional_field'] ) {
+									if ( false !== parse_url( $link ) ) { ?>
+										<?php if ( ( 0 == $user_id && 0 == $portfolio_options['prtfl_link_additional_field_for_non_registered'] ) || 0 != $user_id ) { ?>
+											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
+										<?php } else { ?>
+											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
+										<?php }
+									} else { ?>
+										<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
+									<?php }
+								}
+								if ( 1 == $portfolio_options['prtfl_description_additional_field'] ) { ?>
+									<p><span class="lable"><?php echo $portfolio_options['prtfl_description_text_field']; ?></span> <?php echo str_replace("\n", "<br />", $full_descr); ?></p>
+								<?php }
+								if ( 0 != $user_id && $portfolio_options ) {
+									if ( 1 == $portfolio_options['prtfl_svn_additional_field'] ) { ?>
+										<p><span class="lable"><?php echo $portfolio_options['prtfl_svn_text_field']; ?></span> <?php echo $svn; ?></p>
+									<?php }
+									if ( 1 == $portfolio_options['prtfl_executor_additional_field'] ) {
+										$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' ); ?>
+										<p><span class="lable"><?php echo $portfolio_options['prtfl_executor_text_field']; ?></span>
+										<?php $count = 0;
+										foreach ( $executors_profile as $profile ) {
+											if ( $count > 0 )
+												echo ', '; ?>
+											<a href="<?php echo get_term_link( $profile->slug, 'portfolio_executor_profile'); ?>" title="<?php echo $profile->name; ?> profile" target="_blank"><?php echo $profile->name; ?></a>
+											<?php $count++;
+										} ?>
+										</p>
+									<?php }
+								 } ?>
+							</div><!-- .portfolio_short_content -->
+							<div class="portfolio_images_block">
+								<?php $args = array(
+									'post_parent'		=>	$post->ID,
+									'post_type'			=>	'attachment',
+									'post_mime_type'	=>	'image',
+									'numberposts'		=>	-1,
+									'orderby'			=>	'menu_order',
+									'order'				=>	'ASC',
+									'exclude'			=>	$post_thumbnail_id
+								);
+								$attachments				=	get_children( $args );
+								$array_post_thumbnail_id	=	array_keys( $attachments );
+								$count_element				=	count( $array_post_thumbnail_id );
+
+								while ( list( $key, $value ) = each( $array_post_thumbnail_id ) ) {
+									$image			=	wp_get_attachment_image_src( $value, 'portfolio-photo-thumb' );
+									$image_large	=	wp_get_attachment_image_src( $value, 'large' );
+									$image_alt		=	get_post_meta( $value, '_wp_attachment_image_alt', true );
+									$image_title	=	get_post_meta( $value, '_wp_attachment_image_title', true );
+									$image_desc 	=	get_post($value);
+									$image_desc		=	$image_desc->post_content;
+
+									if ( 0 == $key ) { ?>
+										<span class="lable"><?php echo $portfolio_options['prtfl_screenshot_text_field']; ?></span>
+										<div class="portfolio_images_rows">
+									<?php } ?>
+										<div class="portfolio_images_gallery">
+											<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>">
+												<img src="<?php echo $image[0]; ?>" width="<?php echo $portfolio_options['prtfl_custom_size_px'][1][0]; ?>" height="<?php echo $portfolio_options['prtfl_custom_size_px'][1][1]; ?>" alt="<?php echo $image_alt; ?>" />
+											</a>
+											<br /><?php echo $image_title; ?>
+										</div>
+									<?php if ( 0 == ( $key + 1 ) % $portfolio_options['prtfl_custom_image_row_count'] && 0 != $key && $key + 1 != $count_element) { ?>
+										</div><!-- .portfolio_images_rows -->
+										<div class="portfolio_images_rows">
+									<?php }
+								}
+								if ( 0 < $count_element ) { ?>
+									</div><!-- .portfolio_images_rows -->
+								<?php } ?>
+							</div><!-- .portfolio_images_block -->
+						</div><!-- .entry -->
+						<div class="entry_footer">
+							<div class="read_more">&nbsp;</div>
+							<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
+							if ( is_array( $terms ) && 0 < count( $terms ) ) { ?>
+								<div class="portfolio_terms"><?php echo $portfolio_options['prtfl_technologies_text_field']; ?>
+									<?php $count = 0;
+									foreach ( $terms as $term ) {
+										if ( $count > 0 )
+											echo ', ';
+										echo '<a href="' . get_term_link( $term->slug, 'portfolio_technologies') . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name . '</a>';
+										$count++;
+									} ?>
+								</div><!-- .portfolio_terms -->
+							<?php } ?>
+						</div><!-- .entry_footer -->
+					</div><!-- .portfolio_content -->
+				<?php endwhile;
+				if ( ( ! empty( $image[0] ) || ( ! empty( $attachments ) ) ) ) { ?>
+					<script type="text/javascript">
+						(function($){
+							$(document).ready(function(){
+								<?php if ( ! function_exists( 'is_plugin_active' ) )
+									require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
+								$all_plugins = get_plugins();
+								if ( ( ! is_plugin_active( 'gallery-plugin-pro/gallery-plugin-pro.php' ) ) || ( isset( $all_plugins["gallery-plugin-pro/gallery-plugin-pro.php"]["Version"] ) && "1.3.0" >= $all_plugins["gallery-plugin-pro/gallery-plugin-pro.php"]["Version"] ) ) {  ?>
+									$("a[rel=portfolio_fancybox]").fancybox({
+										'transitionIn'		: 'elastic',
+										'transitionOut'		: 'elastic',
+										'titlePosition' 	: 'inside',
+										'speedIn'			: 500,
+										'speedOut'			: 300,
+										'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
+											return '<span id="fancybox-title-inside">' + ( title.length ? title + '<br />' : '' ) + 'Image ' + ( currentIndex + 1 ) + ' / ' + currentArray.length + '</span>';
+										}
+									});
+								<?php } else { ?>
+									$("a[rel=portfolio_fancybox]").fancybox({
+										openSpeed	:	500, 
+										closeSpeed	:	300,
+										helpers		: {
+											title	: { type : 'inside' }
+										},
+										prevEffect	: 'fade',
+										nextEffect	: 'fade',	
+										openEffect	: 'elastic',
+										closeEffect	: 'elastic',
+										beforeLoad: function() {
+											this.title = '<span id="fancybox-title-inside">' + ( this.title.length ? this.title + '<br />' : '' ) + 'Image ' + ( this.index + 1 ) + ' / ' + this.group.length + '</span>';
+										}
+									});		
+								<?php } ?>
+							});
+						})(jQuery);
+					</script>
+				<?php } ?>
+			</div><!-- #content -->
+		</div><!-- #container -->
+	</div><!-- .content-area -->
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
\ No newline at end of file
--- a/wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio.php	Tue Jun 09 03:35:32 2015 +0200
+++ b/wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio.php	Tue Jun 09 11:14:17 2015 +0000
@@ -1,168 +1,224 @@
 <?php
 /*
 Template Name: Portfolio template
+* Version: 1.3
 */
-
 get_header(); ?>
-
-<?php global $wp_query;
-$portfolio_options = get_option( 'prtfl_options' ); ?>
-		<div id="container" class="site-content">
+	<div class="content-area">
+		<div id="container" class="site-content site-main">
 			<div id="content" class="hentry">
 				<div class="breadcrumbs home_page_title entry-header">
-				<?php if( isset( $wp_query->query_vars["technologies"] ) ) {
-					$term = get_term_by('slug', $wp_query->query_vars["technologies"], 'portfolio_technologies');
-					echo $portfolio_options['prtfl_technologies_text_field']." ".( $term->name );
+					<?php global $post, $wpdb, $wp_query, $request;
+					$portfolio_options = get_option( 'prtfl_options' );
+
+					if ( isset( $wp_query->query_vars["technologies"] ) ) {
+						$term = get_term_by( 'slug', $wp_query->query_vars["technologies"], 'portfolio_technologies' );
+						echo $portfolio_options['prtfl_technologies_text_field'] . " " . ( $term->name );
+					} elseif ( isset( $wp_query->query_vars["portfolio_executor_profile"] ) ) {
+						$term = get_term_by('slug', $wp_query->query_vars["portfolio_executor_profile"], 'portfolio_executor_profile');
+						echo __( 'Executor Profile', 'portfolio' ) . ": <h1>" . ( $term->name ) . "</h1>";
+						$_SESSION['prtfl_page_name'] = __( 'Executor Profile', 'portfolio' ) . ": " . ( $term->name );
+						$_SESSION['prtfl_page_url'] = get_pagenum_link( $wp_query->query_vars['paged'] );
+					} else {
+						the_title();
+					} ?>
+				</div>
+				<?php $count = 0;
+				if ( get_query_var( 'paged' ) ) {
+					$paged = get_query_var( 'paged' );
+				} elseif ( get_query_var( 'page' ) ) {
+					$paged = get_query_var( 'page' );
 				} else {
-					the_title(); 
-				} ?>
-				</div>
-				<?php				
-				$paged = isset( $wp_query->query_vars['paged'] ) ? $wp_query->query_vars['paged'] : 1;
+					$paged = 1;
+				}
+				$per_page = $showitems = get_option( 'posts_per_page' ); 
 				$technologies = isset( $wp_query->query_vars["technologies"] ) ? $wp_query->query_vars["technologies"] : "";
-				if( $technologies != "" ) {
+				$executor_profile = isset( $wp_query->query_vars["portfolio_executor_profile"] ) ? $wp_query->query_vars["portfolio_executor_profile"] : "";
+				if ( "" != $technologies ) {
 					$args = array(
-						'post_type'					=> 'portfolio',
-						'post_status'				=> 'publish',
-						'orderby'					=> $portfolio_options['prtfl_order_by'],
-						'order'						=> $portfolio_options['prtfl_order'],
-						'posts_per_page'			=> get_option( 'posts_per_page' ),
-						'paged'						=> $paged,
-						'tax_query' => array(
-								array(
-									'taxonomy' => 'portfolio_technologies',
-									'field' => 'slug',
-									'terms' => $technologies
-								)
+						'post_type' 		=> 'portfolio',
+						'post_status' 		=> 'publish',
+						'orderby' 			=> $portfolio_options['prtfl_order_by'],
+						'order'			 	=> $portfolio_options['prtfl_order'],
+						'posts_per_page'	=> $per_page,
+						'paged' 			=> $paged,
+						'tax_query' 		=> array(
+							array(
+								'taxonomy' 	=> 'portfolio_technologies',
+								'field' 	=> 'slug',
+								'terms' 	=> $technologies
 							)
-						);
+						)
+					);
+				} else if ( "" != $executor_profile ) {
+					$args = array(
+						'post_type' 		=> 'portfolio',
+						'post_status' 		=> 'publish',
+						'orderby'			=> $portfolio_options['prtfl_order_by'],
+						'order' 			=> $portfolio_options['prtfl_order'],
+						'posts_per_page' 	=> $per_page,
+						'paged' 			=> $paged,
+						'tax_query' 		=> array(
+							array(
+								'taxonomy' 	=> 'portfolio_executor_profile',
+								'field' 	=> 'slug',
+								'terms' 	=> $executor_profile
+							)
+						)
+					);
 				} else {
 					$args = array(
-						'post_type'					=> 'portfolio',
-						'post_status'				=> 'publish',
-						'orderby'					=> $portfolio_options['prtfl_order_by'],
-						'order'						=> $portfolio_options['prtfl_order'],
-						'posts_per_page'			=> get_option( 'posts_per_page' ),
-						'paged'						=> $paged
-						);
+						'post_type'			=>	'portfolio',
+						'post_status'		=>	'publish',
+						'orderby'			=>	$portfolio_options['prtfl_order_by'],
+						'order'				=>	$portfolio_options['prtfl_order'],
+						'posts_per_page'	=>	$per_page,
+						'paged'				=>	$paged
+					);
 				}
 
-				query_posts( $args );
+				$second_query = new WP_Query( $args );
+
+				$pdfprnt_options = get_option('pdfprnt_options_array');
+				if ( empty( $pdfprnt_options ) )
+					$pdfprnt_options = get_option('pdfprntpr_options_array');
+				if (  isset( $pdfprnt_options ) && is_array( $pdfprnt_options ) && true === in_array( 'portfolio', $pdfprnt_options['use_types_posts'] ) ) {
+					if ( function_exists( 'pdfprnt_show_buttons_for_bws_portfolio_post' ) )
+						echo pdfprnt_show_buttons_for_bws_portfolio_post();
+					elseif ( function_exists( 'pdfprntpr_show_buttons_for_bws_portfolio_post' ) )
+						echo pdfprntpr_show_buttons_for_bws_portfolio_post();
+				}
 				
-				while ( have_posts() ) : the_post(); ?>
-					<div class="portfolio_content entry-content">
-						<div class="entry">
-							<?php global $post;
-							$meta_values				= get_post_custom($post->ID);
-							$post_thumbnail_id	= get_post_thumbnail_id( $post->ID );
-							if ( empty ( $post_thumbnail_id ) ) {
-								$args = array(
-									'post_parent' => $post->ID,
-									'post_type' => 'attachment',
-									'post_mime_type' => 'image',
-									'numberposts' => 1
-								);
-								$attachments				= get_children( $args );
-								$post_thumbnail_id	= key($attachments);
-							}
-							$image						= wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
-							$image_large			= wp_get_attachment_image_src( $post_thumbnail_id, 'large' );
-							$image_alt				= get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
-							$image_desc 			= get_post($post_thumbnail_id);
-							$image_desc				= $image_desc->post_content;
-							if ( get_option( 'prtfl_postmeta_update' ) == '1' ) {
-								$post_meta		= get_post_meta( $post->ID, 'prtfl_information', true);
-								$date_compl		= $post_meta['_prtfl_date_compl'];
-								if( ! empty( $date_compl ) && 'in progress' != $date_compl) {
+				$request = $second_query->request;
+
+				if ( $second_query->have_posts() ) : 
+					while ( $second_query->have_posts() ) : $second_query->the_post(); ?>
+						<div class="portfolio_content entry-content">
+							<div class="entry">
+								<?php $meta_values		=	get_post_custom( $post->ID );
+								$post_thumbnail_id	=	get_post_thumbnail_id( $post->ID );
+								if ( empty ( $post_thumbnail_id ) ) {
+									$args = array(
+										'post_parent'		=>	$post->ID,
+										'post_type'			=>	'attachment',
+										'post_mime_type'	=>	'image',
+										'numberposts'		=>	1
+									);
+									$attachments		=	get_children( $args );
+									$post_thumbnail_id	=	key( $attachments );
+								}
+								$image			=	wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
+								$image_large	=	wp_get_attachment_image_src( $post_thumbnail_id, 'large' );
+								$image_alt		=	get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
+								$image_desc 	=	get_post($post_thumbnail_id);
+								$image_desc		=	$image_desc->post_content;
+								$post_meta		=	get_post_meta( $post->ID, 'prtfl_information', true);
+								$date_compl		=	isset( $post_meta['_prtfl_date_compl'] ) ? $post_meta['_prtfl_date_compl'] : '';
+								if ( ! empty( $date_compl ) && 'in progress' != $date_compl) {
 									$date_compl		= explode( "/", $date_compl );
-									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1]."-".$date_compl[0].'-'.$date_compl[2] ) );
-								}
-								$link					= $post_meta['_prtfl_link'];
-								$short_descr	= $post_meta['_prtfl_short_descr'];
-							} else {
-								$date_compl		= get_post_meta( $post->ID, '_prtfl_date_compl', true );
-								if( ! empty( $date_compl ) && 'in progress' != $date_compl) {
-									$date_compl		= explode( "/", $date_compl );
-									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1]."-".$date_compl[0].'-'.$date_compl[2] ) );
+									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1] . "-" . $date_compl[0] . '-' . $date_compl[2] ) );
 								}
-								$link					= get_post_meta($post->ID, '_prtfl_link', true);
-								$short_descr	= get_post_meta($post->ID, '_prtfl_short_descr', true); 
-							} ?>
-
-							<div class="portfolio_thumb">
-								<a rel="bookmark" href="<?php echo get_permalink(); ?>" title="<?php echo get_the_title(); ?>">
-									<img src="<?php echo $image[0]; ?>" width="<?php echo $portfolio_options['prtfl_custom_size_px'][0][0]; ?>" height="<?php echo $portfolio_options['prtfl_custom_size_px'][0][1]; ?>" alt="<?php echo $image_alt; ?>" />
-								</a>
-							</div>
-							<div class="portfolio_short_content">
-								<div class="item_title">
-									<p>
-										<a href="<?php echo get_permalink(); ?>" rel="bookmark"><?php echo get_the_title(); ?></a>
-									</p>
-								</div> <!-- .item_title -->
-								<?php if( 1 == $portfolio_options['prtfl_date_additional_field'] ) { ?>
+								$link			=	isset( $post_meta['_prtfl_link'] ) ? $post_meta['_prtfl_link'] : '';
+								$short_descr	=	isset( $post_meta['_prtfl_short_descr'] ) ? $post_meta['_prtfl_short_descr'] : '';
+								if ( empty( $short_descr ) )
+									$short_descr = get_the_excerpt();
+								$title = get_the_title();
+								if ( empty( $title ) )
+									$title = '(' . __( 'No title', 'portfolio-pro' ) . ')';
+								$permalink = get_permalink(); 
+								if ( ! empty( $image[0] ) ) { ?>
+									<div class="portfolio_thumb">
+										<a rel="bookmark" href="<?php echo $permalink; ?>" title="<?php echo $title; ?>">
+											<img src="<?php echo $image[0]; ?>" width="<?php echo $portfolio_options['prtfl_custom_size_px'][0][0]; ?>" height="<?php echo $portfolio_options['prtfl_custom_size_px'][0][1]; ?>" alt="<?php echo $image_alt; ?>" />
+										</a>
+									</div><!-- .portfolio_thumb -->
+								<?php } ?>
+								<div class="portfolio_short_content">
+									<div class="item_title">
+										<p>
+											<a href="<?php echo $permalink; ?>" rel="bookmark"><?php echo $title; ?></a>
+										</p>
+									</div><!-- .item_title -->
+									<?php if ( 1 == $portfolio_options['prtfl_date_additional_field'] ) { ?>
 										<p>
 											<span class="lable"><?php echo $portfolio_options['prtfl_date_text_field']; ?></span> <?php echo $date_compl; ?>
 										</p>
-								<?php } 
-								$user_id = get_current_user_id();
-								if ( 1 == $portfolio_options['prtfl_link_additional_field'] ) {
-									if( parse_url( $link ) !== false ) { ?>
-										<?php if ( ( $user_id == 0 && 0 == $portfolio_options['prtfl_link_additional_field_for_non_registered'] ) || $user_id != 0 ) { ?>
-											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
-										<?php } else { ?>
+									<?php }
+									$user_id = get_current_user_id();
+									if ( 1 == $portfolio_options['prtfl_link_additional_field'] ) {
+										if ( false !== parse_url( $link ) ) { ?>
+											<?php if ( ( 0 == $user_id && 0 == $portfolio_options['prtfl_link_additional_field_for_non_registered'] ) || 0 != $user_id ) { ?>
+												<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
+											<?php } else { ?>
+												<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
+											<?php }
+										} else { ?>
 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
-										<?php } ?>										
-									<?php } else { ?>
-											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
+										<?php }
+									}
+									if ( 1 == $portfolio_options['prtfl_shrdescription_additional_field'] ) { ?>
+										<p><span class="lable"><?php echo $portfolio_options['prtfl_shrdescription_text_field']; ?></span> <?php echo $short_descr; ?></p>
 									<?php } ?>
-								<?php }
-								if( 1 == $portfolio_options['prtfl_shrdescription_additional_field'] ) { ?>
-										<p><span class="lable"><?php echo $portfolio_options['prtfl_shrdescription_text_field']; ?></span> <?php echo $short_descr; ?></p>
+								</div><!-- .portfolio_short_content -->
+							</div><!-- .entry -->
+							<div class="entry_footer">
+								<div class="read_more">
+									<a href="<?php the_permalink(); ?>" rel="bookmark"><?php _e( 'Read more', 'portfolio' ); ?></a>
+								</div><!-- .read_more -->
+								<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' );
+								if ( is_array( $terms ) && 0 < count( $terms ) ) { ?>
+									<div class="portfolio_terms">
+										<?php echo $portfolio_options['prtfl_technologies_text_field'];
+										$count = 0;
+										foreach ( $terms as $term ) {
+											if ( 0 < $count )
+												echo ', ';
+											echo '<a href="' . get_term_link( $term->slug, 'portfolio_technologies') . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name . '</a>';
+											$count++;
+										} ?>
+									</div><!-- .portfolio_terms -->
 								<?php } ?>
-							</div> <!-- .portfolio_short_content -->
-						</div> <!-- .entry -->
-						<div class="entry_footer">
-							<div class="read_more">
-								<a href="<?php the_permalink(); ?>" rel="bookmark"><?php _e( 'Read more', 'portfolio' ); ?></a>
-							</div> <!-- .read_more -->
-							<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' ) ;
-							if ( is_array( $terms ) && count( $terms ) > 0) { ?>
-								<div class="portfolio_terms"><?php echo $portfolio_options['prtfl_technologies_text_field']; ?>
-								<?php $count = 0;
-								foreach ( $terms as $term ) {
-									if( $count > 0 ) 
-										echo ', '; 
-									echo '<a href="'. get_term_link( $term->slug, 'portfolio_technologies') . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a>';
-									$count++;
-								} ?>
-								</div>
-							<?php } ?>
-						</div> <!-- .entry_footer -->
-					</div> <!-- .portfolio_content -->
-			<?php endwhile; 
-			$portfolio_options = get_option( 'prtfl_options' ); ?>			
-				<script type="text/javascript">
-				(function($){
-					$(document).ready(function(){
-						$("a[rel=portfolio_fancybox]").fancybox({
-							'transitionIn'		: 'elastic',
-							'transitionOut'		: 'elastic',
-							'titlePosition' 	: 'inside',
-							'speedIn'					:	500, 
-							'speedOut'				:	300,
-							'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
-								return '<span id="fancybox-title-inside">' + (title.length ? title + '<br />' : '') + 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
+							</div><!-- .entry_footer -->
+						</div><!-- .portfolio_content -->
+					<?php endwhile;
+				endif; ?>
+			</div><!-- #content -->	
+			<?php $count_all_albums = $second_query->found_posts;
+			wp_reset_query(); 
+			$request = $wp_query->request;
+			$pages = intval( $count_all_albums / $per_page );
+			if ( $count_all_albums % $per_page > 0 )
+				$pages += 1;
+
+			$range = 2;
+
+			if ( ! $pages )
+				$pages = 1;
+
+			if ( 1 != $pages ) { ?>
+				<div class='clear'></div>
+				<div id="portfolio_pagenation">
+					<div class='pagination'>
+						<?php if ( 2 < $paged && $paged > $range + 1 && $showitems < $pages )
+							echo "<a href='" . get_pagenum_link( 1 ) . "'>&laquo;</a>";
+						if ( 1 < $paged && $showitems < $pages )
+							echo "<a href='" . get_pagenum_link( $paged - 1 ) . "'>&lsaquo;</a>";
+
+						for ( $i = 1; $i <= $pages; $i++ ) {
+							if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
+								echo ( $paged == $i ) ? "<span class='current'>" . $i . "</span>":"<a href='" . get_pagenum_link( $i ) . "' class='inactive' >" . $i . "</a>";
 							}
-						});
-					});
-				})(jQuery);
-				</script>
-			</div><!-- #content -->
-			<div id="portfolio_pagenation">
-				<?php if( function_exists( 'prtfl_pagination' ) ) prtfl_pagination(); ?>
-				<input type="hidden" value="Version=2.09" />
-			</div>
+						}
+						if ( $paged < $pages && $showitems < $pages )
+							echo "<a href='" . get_pagenum_link( $paged + 1 ) . "'>&rsaquo;</a>";
+						if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages )
+							echo "<a href='" . get_pagenum_link( $pages ) . "'>&raquo;</a>"; ?>
+						<div class='clear'></div>
+					</div><!-- .pagination -->
+				</div><!-- #portfolio_pagenation -->
+			<?php } ?>
+			<?php comments_template(); ?>
 		</div><!-- #container -->
+	</div><!-- .content-area -->
 <?php get_sidebar(); ?>
 <?php get_footer(); ?>
\ No newline at end of file