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