wp/wp-content/plugins/portfolio/template/portfolio-post.php
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 <?php
       
     2 get_header(); ?>
       
     3 	<div id="container" class="site-content">
       
     4 		<div id="content" class="hentry">
       
     5 				<div class="breadcrumbs home_page_title entry-header">
       
     6 					<?php the_title(); ?>
       
     7 				</div>			
       
     8 				<?php global $wp_query;
       
     9 				while ( have_posts() ) : the_post(); ?>
       
    10 					<div class="portfolio_content entry-content">
       
    11 						<div class="entry">
       
    12 							<?php global $post;
       
    13 							$portfolio_options = get_option( 'prtfl_options' );
       
    14 							$meta_values				= get_post_custom($post->ID);
       
    15 							$post_thumbnail_id	= get_post_thumbnail_id( $post->ID );
       
    16 							if ( empty ( $post_thumbnail_id ) ) {
       
    17 								$args = array(
       
    18 									'post_parent'			=> $post->ID,
       
    19 									'post_type'				=> 'attachment',
       
    20 									'post_mime_type'		=> 'image',
       
    21 									'orderby'				=> 'menu_order',
       
    22 									'order'					=> 'ASC',
       
    23 									'numberposts'			=> 1
       
    24 								);
       
    25 								$attachments				= get_children( $args );
       
    26 								$post_thumbnail_id	= key($attachments);
       
    27 							}
       
    28 							$image				= wp_get_attachment_image_src( $post_thumbnail_id, 'portfolio-thumb' );
       
    29 							$image_large	= wp_get_attachment_image_src( $post_thumbnail_id, 'large' );
       
    30 							$image_alt		= get_post_meta( $post_thumbnail_id, '_wp_attachment_image_alt', true );
       
    31 							$image_desc 			= get_post($post_thumbnail_id);
       
    32 							$image_desc				= $image_desc->post_content;
       
    33 							if ( get_option( 'prtfl_postmeta_update' ) == '1' ) {
       
    34 								$post_meta		= get_post_meta( $post->ID, 'prtfl_information', true);
       
    35 								$date_compl		= $post_meta['_prtfl_date_compl'];
       
    36 								if( ! empty( $date_compl ) && 'in progress' != $date_compl) {
       
    37 									$date_compl		= explode( "/", $date_compl );
       
    38 									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1]."-".$date_compl[0].'-'.$date_compl[2] ) );
       
    39 								}
       
    40 								$link					= $post_meta['_prtfl_link'];
       
    41 								$short_descr	= $post_meta['_prtfl_short_descr'];
       
    42 								$full_descr		= $post->post_content != "" ? $post->post_content : $post_meta['_prtfl_short_descr'];
       
    43 								$svn					= $post_meta['_prtfl_svn'];
       
    44 							} else {
       
    45 								$date_compl		= get_post_meta( $post->ID, '_prtfl_date_compl', true );
       
    46 								if( ! empty( $date_compl ) && 'in progress' != $date_compl) {
       
    47 									$date_compl		= explode( "/", $date_compl );
       
    48 									$date_compl		= date( get_option( 'date_format' ), strtotime( $date_compl[1]."-".$date_compl[0].'-'.$date_compl[2] ) );
       
    49 								}
       
    50 								$link					= get_post_meta($post->ID, '_prtfl_link', true);
       
    51 								$short_descr	= get_post_meta($post->ID, '_prtfl_short_descr', true); 
       
    52 								$full_descr		= $post->post_content != "" ? $post->post_content : get_post_meta($post->ID, '_prtfl_short_descr', true);
       
    53 								$svn					= get_post_meta($post->ID, '_prtfl_svn', true);
       
    54 							} ?>
       
    55 							<div class="portfolio_thumb">
       
    56 								<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>">
       
    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; ?>" />
       
    58 								</a>
       
    59 							</div>
       
    60 							<div class="portfolio_short_content">
       
    61 								<?php if ( 1 == $portfolio_options['prtfl_date_additional_field'] ) { ?>
       
    62 										<p>
       
    63 											<span class="lable"><?php echo $portfolio_options['prtfl_date_text_field']; ?></span> <?php echo $date_compl; ?>
       
    64 										</p>
       
    65 								<?php }
       
    66 								$user_id = get_current_user_id();
       
    67 								if ( 1 == $portfolio_options['prtfl_link_additional_field'] ) {
       
    68 									if ( parse_url( $link ) !== false ) { ?>
       
    69 										<?php if ( ( $user_id == 0 && 0 == $portfolio_options['prtfl_link_additional_field_for_non_registered'] ) || $user_id != 0 ) { ?>
       
    70 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <a href="<?php echo $link; ?>"><?php echo $link; ?></a></p>
       
    71 										<?php } else { ?>
       
    72 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
       
    73 										<?php } ?>										
       
    74 									<?php } else { ?>
       
    75 											<p><span class="lable"><?php echo $portfolio_options['prtfl_link_text_field']; ?></span> <?php echo $link; ?></p>
       
    76 									<?php } ?>
       
    77 								<?php }
       
    78 								if( 1 == $portfolio_options['prtfl_description_additional_field'] ) { ?>
       
    79 										<p><span class="lable"><?php echo $portfolio_options['prtfl_description_text_field']; ?></span> <?php echo str_replace("\n", "<br />", $full_descr); ?></p>
       
    80 								<?php } ?>
       
    81 								<?php if ( 0 != $user_id && $portfolio_options ) {
       
    82 									if( 1 == $portfolio_options['prtfl_svn_additional_field'] ) { ?>
       
    83 										<p><span class="lable"><?php echo $portfolio_options['prtfl_svn_text_field']; ?></span> <?php echo $svn; ?></p>
       
    84 									<?php }
       
    85 									if( 1 == $portfolio_options['prtfl_executor_additional_field'] ) {
       
    86 										$executors_profile = wp_get_object_terms( $post->ID, 'portfolio_executor_profile' ); ?>
       
    87 										<p><span class="lable"><?php echo $portfolio_options['prtfl_executor_text_field']; ?></span>
       
    88 										<?php $count = 0;
       
    89 										foreach($executors_profile as $profile) {
       
    90 											if($count > 0)
       
    91 												$content .= ', '; ?>
       
    92 											<a href="<?php echo $profile->description; ?>" title="<?php echo $profile->name; ?> profile" target="_blank"><?php echo $profile->name; ?></a>
       
    93 											<?php $count++;
       
    94 										} ?>
       
    95 										</p>
       
    96 									<?php }
       
    97 								 } ?>
       
    98 							</div> <!-- .portfolio_short_content -->
       
    99 							<div class="portfolio_images_block">
       
   100 								<?php 
       
   101 								$args = array(
       
   102 									'post_parent'		=> $post->ID,
       
   103 									'post_type'			=> 'attachment',
       
   104 									'post_mime_type' 	=> 'image',
       
   105 									'numberposts'		=> -1,
       
   106 									'orderby'			=> 'menu_order',
       
   107 									'order'				=> 'ASC',
       
   108 									'exclude'			=> $post_thumbnail_id
       
   109 								);
       
   110 								$attachments				= get_children( $args );
       
   111 								$array_post_thumbnail_id	= array_keys($attachments);
       
   112 								$count_element = count( $array_post_thumbnail_id );
       
   113 								
       
   114 								while( list( $key, $value ) = each( $array_post_thumbnail_id ) ) {
       
   115 									$image			= wp_get_attachment_image_src( $value, 'portfolio-photo-thumb' );
       
   116 									$image_large	= wp_get_attachment_image_src( $value, 'large' );
       
   117 									$image_alt		= get_post_meta( $value, '_wp_attachment_image_alt', true );
       
   118 									$image_title	= get_post_meta( $value, '_wp_attachment_image_title', true );
       
   119 									$image_desc 	= get_post($value);
       
   120 									$image_desc		= $image_desc->post_content;
       
   121 									
       
   122 									if( 0 == $key ) { ?>
       
   123 										<span class="lable"><?php echo $portfolio_options['prtfl_screenshot_text_field']; ?></span> 
       
   124 										<div class="portfolio_images_rows">
       
   125 									<?php } ?>
       
   126 										<div class="portfolio_images_gallery">
       
   127 											<a class="lightbox" rel="portfolio_fancybox" href="<?php echo $image_large[0]; ?>" title="<?php echo $image_desc; ?>">
       
   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; ?>" />
       
   129 											</a>
       
   130 											<br /><?php echo $image_title; ?>
       
   131 										</div>
       
   132 									<?php if( 0 == ( $key + 1 ) % $portfolio_options['prtfl_custom_image_row_count'] && 0 != $key && $key + 1 != $count_element) { ?>
       
   133 										</div> <!-- .portfolio_images_rows -->
       
   134 										<div class="portfolio_images_rows">
       
   135 									<?php }
       
   136 								}
       
   137 								if( 0 < $count_element ) { ?>
       
   138 									</div><!-- .portfolio_images_rows -->
       
   139 								<?php } ?>
       
   140 							</div> <!-- .portfolio_images_block -->
       
   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(); ?>