wp/wp-content/themes/IN-MOTION-package-u1/in-motion/portfolio-post.php
changeset 1 f6eb5a861d2f
parent 0 d970ebf37754
child 3 6d22aaa62d12
equal deleted inserted replaced
0:d970ebf37754 1:f6eb5a861d2f
       
     1 <script src="<?php echo get_template_directory_uri(); ?>/js/scriptPortfolio.js" type="text/javascript"></script>
       
     2 
       
     3 <script type="text/javascript">
       
     4 	jQuery(document).ready(function(){
       
     5 		jQuery("a#example1").fancybox();
       
     6 	}); 
       
     7 	
       
     8 </script>
     1 <?php
     9 <?php
     2 get_header(); ?>
    10 
     3 	<div id="container" class="site-content">
    11 if ( have_posts() ) while ( have_posts() ) : the_post();
     4 		<div id="content" class="hentry">
    12 
     5 				<div class="breadcrumbs home_page_title entry-header">
    13    	$portfolioType = get_post_meta($post->ID, 'portfolio_type_selected' , true); 
     6 					<?php the_title(); ?>
    14 	$portfolioDate = get_post_meta($post->ID, 'portfolio_date' , true); 
     7 				</div>			
    15 	$portfolioClient = get_post_meta($post->ID, 'portfolio_client' , true); 
     8 				<?php global $wp_query;
    16 	$portfolioURL = get_post_meta($post->ID, 'portfolio_url' , true);
     9 				while ( have_posts() ) : the_post(); ?>
    17 	$portfolioABSTRACT = get_post_meta($post->ID, 'portfolio_abstract' , true);
    10 					<div class="portfolio_content entry-content">
    18 	$portfolioEMBED = get_post_meta($post->ID, 'portfolio_embed' , true);
    11 						<div class="entry">
    19 	$portfolioTWITTER = get_post_meta($post->ID, 'portfolio_twitter' , true);
    12 							<?php global $post;
    20 
    13 							$portfolio_options = get_option( 'prtfl_options' );
    21 ?>
    14 							$meta_values				= get_post_custom($post->ID);
    22 <div class="item-desc fl">					
    15 							$post_thumbnail_id	= get_post_thumbnail_id( $post->ID );
    23 					<a href="" class="ajax-back" onclick="return backToPorfolios();"><span><?php _e('menu','pego_tr'); ?></span></a>
    16 							if ( empty ( $post_thumbnail_id ) ) {
    24 					
    17 								$args = array(
    25 					<h2><?php  the_title(); ?></h2>
    18 									'post_parent'			=> $post->ID,
    26 					<?php
    19 									'post_type'				=> 'attachment',
    27 						$terms = get_the_term_list( $post->ID,'portfolio_categories', '', ', ');
    20 									'post_mime_type'		=> 'image',
    28 						$terms = strip_tags( $terms );
    21 									'orderby'				=> 'menu_order',
    29 					?>
    22 									'order'					=> 'ASC',
    30 					<p><?php echo $terms; ?></p>
    23 									'numberposts'			=> 1
    31 					<div class="dotted-line"></div>
    24 								);
    32 					<p class="item-text"><?php echo get_the_content(); ?></p>
    25 								$attachments				= get_children( $args );
    33 					<?php					
    26 								$post_thumbnail_id	= key($attachments);
    34 					if (!empty($portfolioURL))
    27 							}
    35 					{
    28 							$image				= wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
    36 						?>
    29 							$image_large	= wp_get_attachment_image_src( $post_thumbnail_id, 'large' );
    37 					<div class="url-stuff fl" style="margin-top: 0;margin-right:5px;">
    30 							$image_alt		= get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
    38 						<a href="<?php echo $portfolioURL; ?>" target="_blank">Controverse</a>
    31 							$image_desc 			= get_post($post_thumbnail_id);
    39 					</div>
    32 							$image_desc				= $image_desc->post_content;
    40 					<?php 
    33 							if ( get_option( 'prtfl_postmeta_update' ) == '1' ) {
    41 					}
    34 								$post_meta		= get_post_meta( $post->ID, 'prtfl_information', true);
    42 					?>
    35 								$date_compl		= $post_meta['_prtfl_date_compl'];
    43 					<?php					
    36 								if( ! empty( $date_compl ) && 'in progress' != $date_compl) {
    44 					if (!empty($portfolioABSTRACT))
    37 									$date_compl		= explode( "/", $date_compl );
    45 					{
    38 									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1]."-".$date_compl[0].'-'.$date_compl[2] ) );
    46 						?>
    39 								}
    47 					<div class="url-stuff fl" style="margin-top: 0;margin-right:5px;">
    40 								$link					= $post_meta['_prtfl_link'];
    48 						<a href="<?php echo $portfolioABSTRACT; ?>" target="_blank">Abstract</a>
    41 								$short_descr	= $post_meta['_prtfl_short_descr'];
    49 					</div>
    42 								$full_descr		= $post->post_content != "" ? $post->post_content : $post_meta['_prtfl_short_descr'];
    50 					<?php 
    43 								$svn					= $post_meta['_prtfl_svn'];
    51 					}
    44 							} else {
    52 					?>
    45 								$date_compl		= get_post_meta( $post->ID, '_prtfl_date_compl', true );
    53 					<?php					
    46 								if( ! empty( $date_compl ) && 'in progress' != $date_compl) {
    54 					if (!empty($portfolioClient))
    47 									$date_compl		= explode( "/", $date_compl );
    55 					{
    48 									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1]."-".$date_compl[0].'-'.$date_compl[2] ) );
    56 						?>
    49 								}
    57 					<div class="url-stuff fl" style="margin-top: 0;margin-right:5px;margin-bottom:10px;">
    50 								$link					= get_post_meta($post->ID, '_prtfl_link', true);
    58 						<a href="<?php echo $portfolioClient; ?>" target="_blank">Site de l'intervenant</a>
    51 								$short_descr	= get_post_meta($post->ID, '_prtfl_short_descr', true); 
    59 						
    52 								$full_descr		= $post->post_content != "" ? $post->post_content : get_post_meta($post->ID, '_prtfl_short_descr', true);
    60 					</div>
    53 								$svn					= get_post_meta($post->ID, '_prtfl_svn', true);
    61 					<?php 
    54 							} ?>
    62 					}
    55 							<div class="portfolio_thumb">
    63 					?>
    56 								<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>">
    64 
    57 									<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; ?>" />
    65 
    58 								</a>
    66 					<?php					
    59 							</div>
    67 					if (!empty($portfolioTWITTER))
    60 							<div class="portfolio_short_content">
    68 					{
    61 								<?php if ( 1 == $portfolio_options['prtfl_date_additional_field'] ) { ?>
    69 					?>
    62 										<p>
    70 					<div class="url-stuff fl" style="margin-top: 10px;margin-right:5px;margin-bottom:10px; width:100%;">
    63 											<span class="lable"><?php echo $portfolio_options['prtfl_date_text_field']; ?></span> <?php echo $date_compl; ?>
    71 						<a href="https://twitter.com/<?php echo $portfolioTWITTER; ?>" target="_blank">@<?php echo $portfolioTWITTER; ?></a>
    64 										</p>
    72 					</div>
    65 								<?php }
    73 					<?php 
    66 								$user_id = get_current_user_id();
    74 					}
    67 								if ( 1 == $portfolio_options['prtfl_link_additional_field'] ) {
    75 					?>
    68 									if ( parse_url( $link ) !== false ) { ?>
    76 
    69 										<?php if ( ( $user_id == 0 && 0 == $portfolio_options['prtfl_link_additional_field_for_non_registered'] ) || $user_id != 0 ) { ?>
    77 					<?php					
    70 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
    78 					if (!empty($portfolioEMBED))
    71 										<?php } else { ?>
    79 					{
    72 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
    80 					?>
    73 										<?php } ?>										
    81 					<div class="url-stuff fl" style="margin-top: 10px;margin-right:5px;margin-bottom:10px; width:100%;">
    74 									<?php } else { ?>
    82 						<?php echo $portfolioEMBED; ?>
    75 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
    83 					</div>
    76 									<?php } ?>
    84 					<?php 
    77 								<?php }
    85 					}
    78 								if( 1 == $portfolio_options['prtfl_description_additional_field'] ) { ?>
    86 					?>
    79 										<p><span class="lable"><?php echo $portfolio_options['prtfl_description_text_field']; ?></span> <?php echo str_replace("\n", "<br />", $full_descr); ?></p>
    87 
    80 								<?php } ?>
    88 
    81 								<?php if ( 0 != $user_id && $portfolio_options ) {
    89 
    82 									if( 1 == $portfolio_options['prtfl_svn_additional_field'] ) { ?>
    90 				</div>
    83 										<p><span class="lable"><?php echo $portfolio_options['prtfl_svn_text_field']; ?></span> <?php echo $svn; ?></p>
    91 				
    84 									<?php }
    92 	  <div class="col-570 fl">
    85 									if( 1 == $portfolio_options['prtfl_executor_additional_field'] ) {
    93 	  <?php
    86 										$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' ); ?>
    94 		
    87 										<p><span class="lable"><?php echo $portfolio_options['prtfl_executor_text_field']; ?></span>
    95 		if($portfolioType == 'Image') 			
    88 										<?php $count = 0;
    96 		{
    89 										foreach($executors_profile as $profile) {
    97 			$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
    90 											if($count > 0)
    98 			?>
    91 												$content .= ', '; ?>
    99 			<a id="example1" class="lightbox-image mw570"  href="<?php echo $image[0]; ?>"><img src="<?php echo $image[0]; ?>"  alt="" /></a>
    92 											<a href="<?php echo $profile->description; ?>" title="<?php echo $profile->name; ?> profile" target="_blank"><?php echo $profile->name; ?></a>
   100 			<?php					
    93 											<?php $count++;
   101 		}
    94 										} ?>
   102 		// end if image
    95 										</p>
   103 	    
    96 									<?php }
   104 	   //video portfolio
    97 								 } ?>
   105 	   if($portfolioType == 'Video') 		
    98 							</div> <!-- .portfolio_short_content -->
   106 		{
    99 							<div class="portfolio_images_block">
   107 	 		$video_url= get_post_meta($post->ID, 'portfolio_video_url' , true);   
   100 								<?php 
   108 	 		if(!empty($video_url)) 
   101 								$args = array(
   109 	 		{
   102 									'post_parent'		=> $post->ID,
   110 	 			echo '<figure>'.$video_url.'</figure>';
   103 									'post_type'			=> 'attachment',
   111 	 		}						
   104 									'post_mime_type' 	=> 'image',
   112 	 	}
   105 									'numberposts'		=> -1,
   113 	 	// end if video
   106 									'orderby'			=> 'menu_order',
   114 	 	
   107 									'order'				=> 'ASC',
   115 	   //slideshow portfolio
   108 									'exclude'			=> $post_thumbnail_id
   116 	if($portfolioType == 'Slideshow') 		
   109 								);
   117 		{	
   110 								$attachments				= get_children( $args );
   118 				$attachments = get_children(array('post_parent' => $post->ID,
   111 								$array_post_thumbnail_id	= array_keys($attachments);
   119 					                        'post_status' => 'inherit',
   112 								$count_element = count( $array_post_thumbnail_id );
   120 				                           'post_type' => 'attachment',
   113 								
   121 					                        'post_mime_type' => 'image',
   114 								while( list( $key, $value ) = each( $array_post_thumbnail_id ) ) {
   122 					                        'order' => 'ASC',
   115 									$image			= wp_get_attachment_image_src( $value, 'portfolio-photo-thumb' );
   123 					                        'orderby' => 'menu_order ID'));
   116 									$image_large	= wp_get_attachment_image_src( $value, 'large' );
   124 											
   117 									$image_alt		= get_post_meta( $value, '_wp_attachment_image_alt', true );
   125 																				
   118 									$image_title	= get_post_meta( $value, '_wp_attachment_image_title', true );
   126 					 		
   119 									$image_desc 	= get_post($value);
   127 									echo '<div id="slides1">';
   120 									$image_desc		= $image_desc->post_content;
   128 									echo '<div class="slides_container">';
   121 									
   129 									
   122 									if( 0 == $key ) { ?>
   130 									foreach($attachments as $att_id => $attachment) {
   123 										<span class="lable"><?php echo $portfolio_options['prtfl_screenshot_text_field']; ?></span> 
   131 										$full_img_url = wp_get_attachment_url($attachment->ID);
   124 										<div class="portfolio_images_rows">
   132 										echo '<div class="slide">';
   125 									<?php } ?>
   133 										?>
   126 										<div class="portfolio_images_gallery">
   134 										<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>
   127 											<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>">
   135 										<?php
   128 												<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; ?>" />
   136 										echo '</div>';
   129 											</a>
   137 								} //end foreach
   130 											<br /><?php echo $image_title; ?>
   138 								echo '</div>';
   131 										</div>
   139 								echo '</div>';									
   132 									<?php if( 0 == ( $key + 1 ) % $portfolio_options['prtfl_custom_image_row_count'] && 0 != $key && $key + 1 != $count_element) { ?>
   140 	 	}
   133 										</div> <!-- .portfolio_images_rows -->
   141  	?>
   134 										<div class="portfolio_images_rows">
   142 				</div>
   135 									<?php }
   143 				<div class="clearfix"></div>             
   136 								}
   144 <?php
   137 								if( 0 < $count_element ) { ?>
   145 endwhile;
   138 									</div><!-- .portfolio_images_rows -->
   146 ?>    
   139 								<?php } ?>
   147 
   140 							</div> <!-- .portfolio_images_block -->
   148                     
   141 						</div> <!-- .entry -->
       
   142 						<div class="entry_footer">
       
   143 							<div class="read_more">&nbsp;</div>
       
   144 							<?php $terms = wp_get_object_terms( $post->ID, 'portfolio_technologies' ) ;			
       
   145 							if ( is_array( $terms ) && count( $terms ) > 0) { ?>
       
   146 								<div class="portfolio_terms"><?php echo $portfolio_options['prtfl_technologies_text_field']; ?>
       
   147 								<?php $count = 0;
       
   148 								foreach ( $terms as $term ) {
       
   149 									if( $count > 0 ) 
       
   150 										echo ', '; 
       
   151 									echo '<a href="'. get_term_link( $term->slug, 'portfolio_technologies') . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a>';
       
   152 									$count++;
       
   153 								} ?>
       
   154 								</div>
       
   155 							<?php } ?>
       
   156 						</div> <!-- .entry_footer -->
       
   157 					</div> <!-- .portfolio_content -->
       
   158 			<?php endwhile; ?>			
       
   159 				<script type="text/javascript">
       
   160 				(function($){
       
   161 					$(document).ready(function(){
       
   162 						$("a[rel=portfolio_fancybox]").fancybox({
       
   163 							'transitionIn'		: 'elastic',
       
   164 							'transitionOut'		: 'elastic',
       
   165 							'titlePosition' 	: 'inside',
       
   166 							'speedIn'					:	500, 
       
   167 							'speedOut'				:	300,
       
   168 							'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
       
   169 								return '<span id="fancybox-title-inside">' + (title.length ? title + '<br />' : '') + 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
       
   170 							}						
       
   171 						});
       
   172 					});
       
   173 				})(jQuery);
       
   174 				</script>
       
   175 			</div><!-- #content -->
       
   176 		</div><!-- #container -->
       
   177 		<input type="hidden" value="Version=2.09" />
       
   178 <?php get_sidebar(); ?>
       
   179 <?php get_footer(); ?>