Advertisement
Dibba7

portoflio

Nov 7th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.51 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <div class="single_portfolio_container">
  4.     <?php
  5.     $repeater = get_field("slider");
  6.     if($repeater):
  7.     ?>
  8.     <div class="portfoli_galery_container">
  9.         <nav class="portfolio-navigation">
  10.             <a href="#" class="next"><i class="fa fa-angle-right"></i></a>
  11.             <a href="#" class="prev"><i class="fa fa-angle-left"></i></a>
  12.         </nav>
  13.        
  14.         <ul>
  15.             <?php
  16.                 if($repeater):
  17.                     foreach($repeater as $r):
  18.             ?>
  19.                 <li class="<?php echo $r["fit_to_screen"] ? "img_fit" : ""; ?>">
  20.                     <?php
  21.                     if($r["acf_fc_layout"] == "image"):
  22.                     $html = "<img data-fit='".$r["fit_to_screen"]."' src='".$r["image"]["url"]."' alt='".$r["image"]["alt"]."'/>";
  23.                     echo apply_filters( 'post_thumbnail_html', $html, $post->ID , $r["image"]["id"], "large" , array("alt"=>$r["image"]["alt"]) );
  24.                     else:
  25.                         echo getVideoEmbed($r["video_url"]);
  26.                     endif;
  27.                     ?>
  28.                 </li>
  29.             <?php
  30.                     endforeach;
  31.                 endif;
  32.             ?>
  33.         </ul>
  34.     </div> <!-- portfoli_galery_container :END -->
  35.    
  36.     <br style="clear: both"/>
  37.     <?php endif; ?>
  38.     <div class="portfolio_info">
  39.         <h1><?php the_title(); ?></h1>
  40.         <?php
  41.         $terms = wp_get_post_terms( $post->ID,"portfolio_category" );
  42.         $terms_html_array = array();
  43.         $terms_id_array = array();
  44.         $term_classes = "";
  45.         foreach($terms as $t){
  46.             $term_name = $t->name;
  47.             $term_link = get_term_link($t->slug,$t->taxonomy);
  48.             array_push($terms_html_array,"<a href='{$term_link}'>{$term_name}</a>");
  49.             array_push($terms_id_array,$t->slug);
  50.             $term_classes .= "um_".$t->slug." ";
  51.         }
  52.         $terms_html_array = implode(", ",$terms_html_array);
  53.         if($terms_html_array):
  54.             ?>
  55.             <div class="port_category_container">
  56.                 <i class="fa fa-folder"></i> <?php echo $terms_html_array;?>
  57.             </div>
  58.         <?php endif; ?>
  59.         <?php
  60.             global $post;
  61.             setup_postdata($post);
  62.             the_content();
  63.         ?>
  64.     <?php if(get_field("button_text") && get_field("button_url")): ?>
  65.         <div class="view_project_grid"><a target="_blank" class="view_project" href="<?php the_field("button_url"); ?>"><?php the_field("button_text"); ?></a></div>
  66.     <?php endif; ?>
  67.     </div> <!-- portfolio_info :END -->
  68.     <div class="portfolio_social_sharing">
  69.         <i class="fa fa-facebook"></i><a class="facebook_share" href="<?php the_permalink(); ?>"><?php _e("Share","um_lang"); ?></a>
  70.         <i class="fa fa-twitter"><a class="twitter_share" href="<?php the_permalink(); ?>"></i><?php _e("Tweet","um_lang"); ?></a>
  71.         <i class="fa fa-linkedin"><a class="linkedin_share" href="<?php the_permalink(); ?>"></i><?php _e("Share","um_lang"); ?></a>
  72.         <?php if(get_field("pinterest_image")): ?>
  73.             <i class="fa fa-pinterest"><a data-image="<?php the_field("pinterest_image"); ?>" class="pinteres_share" href="<?php the_permalink(); ?>"></i><?php _e("Pin","um_lang"); ?></a>
  74.         <?php endif; ?>
  75.     </div>  <!-- portfolio_social_sharing :END -->
  76.     </div>
  77. </div> <!-- single_portfolio_container :END -->
  78. <script type="text/javascript">
  79.     jQuery(document).ready(function($){
  80.         $(".single_portfolio_container").waitForImages(function(){
  81.             $(".portfoli_galery_container").css("height" , $(window).height() * 0.8 + "px");
  82.             /*Center Images First*/
  83.             $(window).resize(function(){
  84.                 $(".portfoli_galery_container").css("height" , $(window).height() * 0.8 + "px");
  85.                 var visible_li = $(".portfoli_galery_container li:visible");
  86.                 $(".portfoli_galery_container li").show();
  87.                 center_image();
  88.                 $(".portfoli_galery_container li").hide();
  89.                 visible_li.show();
  90.             });
  91.             center_image();
  92.             function center_image(){
  93.                 jQuery('.portfoli_galery_container li').find('img').each(function(){
  94.                     var this_img = jQuery(this);
  95.  
  96.                     /*If image is portrait make it look better*/
  97.                     if(this_img.width() > this_img.height() && this_img.data("fit")){
  98.                         this_img.css("height","auto");
  99.                         this_img.css("width","100%");
  100.                     }
  101.                     /*If image is portrait make it look better*/
  102.  
  103.                     var parent_width = parseInt(this_img.parent().width() / 2);
  104.                     var this_img_width = parseInt(this_img.width() / 2);
  105.  
  106.                     var parent_height = parseInt(this_img.parent().height() / 2);
  107.                     var this_img_height = parseInt(this_img.height() / 2);
  108.  
  109.                     this_img.css("margin-left",(parent_width - this_img_width) + "px");
  110.                     this_img.css("margin-top",(parent_height - this_img_height) + "px");
  111.                 });
  112.             }
  113.             /*Center Images First*/
  114.             $(".portfoli_galery_container li").hide();
  115.             $(".portfoli_galery_container li:eq(0)").show();
  116.  
  117.             /*Navigate Through Slider*/
  118.             $("a.next").click(function(e){
  119.                 e.preventDefault();
  120.                 var cur_slide = $(".portfoli_galery_container li:visible");
  121.                 var next_slide = cur_slide.next();
  122.                 if(!next_slide.length){
  123.                     next_slide = $(".portfoli_galery_container li:eq(0)");
  124.                 }
  125.                 cur_slide.stop(true,true).fadeOut("fast",function(){
  126.                     next_slide.stop(true,true).fadeIn("fast");
  127.                 });
  128.                 playPuaseVideo(next_slide);
  129.             });
  130.  
  131.             $("a.prev").click(function(e){
  132.                 e.preventDefault();
  133.                 var cur_slide = $(".portfoli_galery_container li:visible");
  134.                 var next_slide = cur_slide.prev();
  135.                 if(!next_slide.length){
  136.                     next_slide = $(".portfoli_galery_container li:last");
  137.                 }
  138.                 cur_slide.stop(true,true).fadeOut("fast",function(){
  139.                     next_slide.stop(true,true).fadeIn("fast");
  140.                 });
  141.                 playPuaseVideo(next_slide);
  142.             });
  143.             /*Navigate Through Slider*/
  144.             $(".portfoli_galery_container ul li:not(.img_fit)").imgLiquid({
  145.                 fill : false
  146.             });
  147.         });
  148.     });
  149. </script>
  150.  
  151. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement