Advertisement
Guest User

Untitled

a guest
May 17th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.34 KB | None | 0 0
  1. <div id="project_info" class="project_info_video">
  2. <a id="project_info_icon<?php echo get_field("menu_position","options") == "Top" ? "_down" : ""; ?>" class="project_info_js" href="javascript:"><i class="icon-reorder"></i></a>
  3. <div class="pr_info_holder <?php echo get_field("menu_position","options") == "Top" ? "pr_info_holder_menu_top" : ""; ?>">
  4. <div>
  5. <h4><?php the_title(); ?></h4>
  6. <div class="c_nav">
  7. <?php
  8. $terms = wp_get_post_terms( $post->ID,"portfolio_category" );
  9. $terms_html_array = array();
  10. $terms_id_array = array();
  11. $term_classes = "";
  12. foreach($terms as $t){
  13. $term_name = $t->name;
  14. $term_link = get_term_link($t->slug,$t->taxonomy);
  15. array_push($terms_html_array,"<a href='{$term_link}'>{$term_name}</a>");
  16. array_push($terms_id_array,$t->slug);
  17. $term_classes .= "um_".$t->slug." ";
  18. }
  19. $terms_html_array = implode(", ",$terms_html_array);
  20. if($terms_html_array):
  21. ?>
  22. <div class="categories">
  23. <i class="icon-folder-close"></i><?php echo $terms_html_array;?>
  24. </div>
  25. <?php
  26. endif;
  27.  
  28. if($GLOBALS["um_likes"]):
  29. $coockie_offset = 'um_liked_'.$post->ID;
  30. $liked = isset($_COOKIE[$coockie_offset]) && $_COOKIE[$coockie_offset] ? "liked" : "";
  31. ?>
  32. <a class="like <?php echo $liked; ?>" href="#" data-postid="<?php echo $post->ID; ?>">
  33. <i class="icon-heart"></i><p><?php echo get_likes(); ?></p>
  34. </a>
  35. <?php endif; ?>
  36. </div>
  37. <?php
  38. global $post;
  39. setup_postdata($post);
  40. the_content();
  41. if(get_field("link_button_text") && get_field("link_button_url")):
  42. ?>
  43. <a class="visit_site" href="<?php the_field("link_button_url"); ?>">
  44. <?php the_field("link_button_text"); ?>
  45. </a>
  46. <?php endif; ?>
  47. </div>
  48. </div>
  49. </div>
  50.  
  51. <div class="video_fullscreen">
  52. <div class="video_overlay" style="opacity:0.5;background: #000"></div>
  53. <?php
  54. $url = get_field("video_url");
  55. $youtube = "";
  56. $vimeo = "";
  57. if($url):
  58. preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $youtube);
  59. sscanf(parse_url($url, PHP_URL_PATH), '/%d', $vimeo);
  60. if($vimeo):
  61. ?>
  62. <iframe class="vimeo" src="http://player.vimeo.com/video/<?php echo $vimeo; ?>?api=1" width="100%" height="100%" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
  63. <?php else: ?>
  64. <div id="ov_vid" data-vid="<?php echo $youtube[0]; ?>"></div>
  65. <?php endif; ?>
  66. <?php else: ?>
  67. <video autoplay="autoplay" id="player" loop="loop" controls="controls">
  68. <?php if(get_field("video_mp4")): ?>
  69. <source type="video/mp4" src="<?php the_field("video_mp4"); ?>" />
  70. <?php elseif(get_field("video_mp4")): ?>
  71. <source type="video/mp4" src="<?php the_field("video_mp4_url"); ?>" />
  72. <?php endif; ?>
  73.  
  74. <?php if(get_field("video_vp8")): ?>
  75. <source type="video/webm" src="<?php the_field("video_vp8"); ?>" />
  76. <?php elseif(get_field("video_mp4")): ?>
  77. <source type="video/webm" src="<?php the_field("video_vp8_url"); ?>" />
  78. <?php endif; ?>
  79.  
  80. <?php if(get_field("video_ogg")): ?>
  81. <source type="video/ogg" src="<?php the_field("video_ogg"); ?>" />
  82. <?php elseif(get_field("video_mp4")): ?>
  83. <source type="video/ogg" src="<?php the_field("video_ogg_url"); ?>" />
  84. <?php endif; ?>
  85. </video>
  86. <?php endif; ?>
  87. </div>
  88.  
  89. <div id="slides" style="display: none">
  90. <ul class="slides-container">
  91. <li>
  92. <?php if(get_field("video_poster")): ?>
  93. <img src="<?php the_field("video_poster"); ?>"/>
  94. <?php endif; ?>
  95. <div class="img_overlay" style="opacity: 0.1;background: #000000"></div>
  96. <div class="capture">
  97. <?php if(get_field("label")): ?>
  98. <p class="fadeInDown animated">
  99. <?php the_field("label"); ?>
  100. </p>
  101. <?php endif;?>
  102. <br style="clear: both">
  103. <?php if(get_field("video_url")): ?>
  104. <a class="fadeInDown animated" href="<?php the_field("video_url"); ?>"><?php _e("Watch video","um_lang"); ?></a>
  105. <?php endif; ?>
  106. </div>
  107. </li>
  108. <li>
  109. <?php if(get_field("video_poster")): ?>
  110. <img src="<?php the_field("video_poster"); ?>"/>
  111. <?php endif; ?>
  112. <div class="img_overlay" style="opacity: 0.1;background: #000000"></div>
  113. <div class="capture">
  114. <?php if(get_field("label")): ?>
  115. <p class="fadeInDown animated">
  116. <?php the_field("label"); ?>
  117. </p>
  118. <?php endif;?>
  119. <br style="clear: both">
  120. <?php if(get_field("button_text") && get_field("button_url")): ?>
  121. <a class="fadeInDown animated" href="<?php the_field("button_url"); ?>"><?php the_field("button_text"); ?></a>
  122. <?php endif; ?>
  123. </div>
  124. </li>
  125. </ul>
  126. </div>
  127.  
  128. <?php
  129. $projects_page = "";
  130. if(get_field("projects_page","options")){
  131. $projects_page = get_field("projects_page","options");
  132. }else{
  133. $the_query = new WP_Query( array(
  134. "post_type" => "page",
  135. "meta_query" => array(
  136. array(
  137. "key" => "_wp_page_template",
  138. "value" => array("template-projects.php","template-projects-grid.php")
  139. )
  140. )
  141. ) );
  142. if($the_query->have_posts()){
  143. $the_query->the_post();
  144. $projects_page = get_permalink($post->ID);
  145. }
  146. wp_reset_postdata();
  147. }
  148. ?>
  149. <div class="<?php echo get_field("menu_position","options") == "Top" ? "project_vid_back_bottom" : "project_vid_back_top"; ?>">
  150. <a href="<?php echo $projects_page; ?>" class="close_btn" onclick="<?php if(!$projects_page): ?>history.go(-1);return false;<?php endif; ?>" ><i class="icon-th"></i></a>
  151. </div>
  152.  
  153. <script type="text/javascript">
  154. var onMessageReceived,onYouTubeIframeAPIReady;
  155. jQuery(document).ready(function($){
  156. $("a.close_btn").click(function(e){
  157. if(window.history.length > 1){
  158. e.preventDefault();
  159. e.stopPropagation();
  160. history.go(-1);
  161. }
  162. });
  163.  
  164. var touch = Modernizr.touch;
  165. if(!touch){
  166. <?php if($vimeo): ?>
  167. /*Vimeo API*/
  168. var f = jQuery('iframe.vimeo');
  169. url = f.attr('src').split('?')[0];
  170. onMessageReceived = function(e) {
  171. var data = JSON.parse(e.data);
  172.  
  173. switch (data.event) {
  174. case 'ready':
  175. onReady();
  176. break;
  177. }
  178. }
  179. function onReady() {
  180. post("play","");
  181. post("setLoop","1");
  182. post("setVolume",parseFloat("<?php the_field("video_volume"); ?>") * 10);
  183. }
  184. if (window.addEventListener) {
  185. window.addEventListener('message', onMessageReceived, false);
  186. }
  187. else{
  188. window.attachEvent('onmessage', onMessageReceived, false);
  189. }
  190. function post(action, value) {
  191. var data = { method: action };
  192.  
  193. if (value) {
  194. data.value = value;
  195. }
  196.  
  197. f[0].contentWindow.postMessage(JSON.stringify(data), url);
  198. }
  199. /*Vimeo API*/
  200. <?php
  201. endif;
  202. if($youtube):
  203. ?>
  204. /*Youtube API*/
  205. var player;
  206. onYouTubeIframeAPIReady = function() {
  207. var vid = jQuery("#ov_vid").data("vid");
  208. try{
  209. if(typeof YT === 'object'){
  210. player = new YT.Player('ov_vid', {
  211. height: '100%',
  212. width: '100%',
  213. videoId: vid,
  214. playerVars: { 'h1' : 1 , 'modestbranding' : 0, 'disablekb' : 1, 'autoplay': 1, 'controls': 0, 'playlist': vid, 'loop': 1, 'showinfo': 0, 'wmode': 'transparent' , 'iv_load_policy' : '3'},
  215. events: {
  216. 'onReady': onPlayerReady
  217. }
  218. });
  219. }
  220. }catch(err){
  221.  
  222. }
  223. }
  224. //onYouTubeIframeAPIReady();
  225. $('.inner_content').waitForImages(function(){
  226. onYouTubeIframeAPIReady();
  227. });
  228. function onPlayerReady(event) {
  229. event.target.setVolume(parseFloat("<?php the_field("video_volume"); ?>") * 10);
  230. }
  231. /*Youtube API*/
  232. <?php endif; ?>
  233. }
  234.  
  235. $(".loader").stop(true,true).show();
  236. var project_info_width = $("#project_info").width();
  237. $("#project_info").css("left",-(project_info_width) + 'px');
  238. $('.accordion li:first-child').find('a').addClass('active').find('i').removeClass('icon-plus-sign').addClass('icon-minus-sign');
  239. $('.accordion li:first-child').find('.section_content').show();
  240.  
  241. $('.tabs .tab_buttons > li:first-child').find('a').addClass('active');
  242. $('.tabs .tab_content li:first-child').show();
  243.  
  244. $('.pr_info_holder').niceScroll();
  245. $('#slides').waitForImages(function(){
  246. hide_loader();
  247. });
  248. if(touch){
  249. jQuery(".video_fullscreen").next().hide();
  250. jQuery(".video_fullscreen").hide();
  251. jQuery("#slides").show();
  252. jQuery("#slides").superslides({
  253. pagination : false
  254. });
  255. }else{
  256. jQuery('video').mediaelementplayer({
  257. pluginPath : template_directory+"/assets/mediaelement/",
  258. startVolume : parseFloat("<?php the_field("video_volume"); ?>"),
  259. loop: true,
  260. features : ['volume'],
  261. enableAutosize : false,
  262. videoWidth : "100%",
  263. videoHeight : "100%"
  264. });
  265. }
  266. });
  267. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement