Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.16 KB | None | 0 0
  1. <?php if(isset($_REQUEST["um_page"])): ?>
  2. <div>
  3. <div class="column-4 row filterable">
  4. <?php
  5. $arguments = array();
  6. $arguments["post_type"] = "portfolio";
  7. $exlucde_cats = get_field("exclude_categories");
  8. $exlucde_cats_arr = array();
  9. if($exlucde_cats){
  10. foreach($exlucde_cats as $cat){
  11. array_push($exlucde_cats_arr,$cat["category"]->slug);
  12. }
  13. $arguments["tax_query"] = array(array(
  14. 'taxonomy' => 'portfolio_category',
  15. 'field' => 'slug',
  16. 'terms' => $exlucde_cats_arr,
  17. 'operator' => 'NOT IN'
  18. ));
  19. }
  20. $arguments["posts_per_page"] = -1;
  21. $arguments["paged"] = $_REQUEST["um_paged"];
  22. $the_query = new WP_Query( $arguments );
  23. while ( $the_query->have_posts() ) : $the_query->the_post();
  24. $terms = wp_get_post_terms( $post->ID,"portfolio_category" );
  25. $terms_html_array = array();
  26. $terms_id_array = array();
  27. $term_classes = "";
  28. foreach($terms as $t){
  29. $term_name = $t->name;
  30. $term_link = get_term_link($t->slug,$t->taxonomy);
  31. array_push($terms_html_array,"<a href='{$term_link}'>{$term_name}</a>");
  32. array_push($terms_id_array,$t->slug);
  33. $term_classes .= "um_".$t->slug." ";
  34. }
  35. $terms_html_array = implode(", ",$terms_html_array);
  36. ?>
  37. <div class="column project_block post_block col-sm-3 mix_all <?php echo $term_classes; ?>" data-filter='<?php echo implode(" ",$terms_id_array); ?> mix_all'>
  38. <div class="post-thumb">
  39. <a href="<?php the_permalink(); ?>">
  40. <div class="hover-state">
  41. <p class="likes"><i class="icon-heart"></i> <?php echo get_likes(); ?></p>
  42. <p class="cont"><i class="icon-search"></i></p>
  43. </div>
  44. <?php the_post_thumbnail("work_post"); ?>
  45. </a>
  46. </div>
  47. <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
  48. <ul>
  49. <?php if($terms_html_array): ?>
  50. <li><i class='icon-angle-right'></i><?php echo $terms_html_array; ?></li>
  51. <?php endif; ?>
  52. </ul>
  53. </div>
  54. <?php endwhile; wp_reset_postdata(); ?>
  55. </div>
  56.  
  57. <div class="column-2 row filterable">
  58. <?php
  59. $arguments = array();
  60. $arguments["post_type"] = "portfolio";
  61. $exlucde_cats = get_field("exclude_categories");
  62. $exlucde_cats_arr = array();
  63. if($exlucde_cats){
  64. foreach($exlucde_cats as $cat){
  65. array_push($exlucde_cats_arr,$cat["category"]->slug);
  66. }
  67. $arguments["tax_query"] = array(array(
  68. 'taxonomy' => 'portfolio_category',
  69. 'field' => 'slug',
  70. 'terms' => $exlucde_cats_arr,
  71. 'operator' => 'NOT IN'
  72. ));
  73. }
  74. $arguments["posts_per_page"] = -1;
  75. $arguments["paged"] = $_REQUEST["um_paged"];
  76. $the_query = new WP_Query( $arguments );
  77. while ( $the_query->have_posts() ) : $the_query->the_post();
  78. $terms = wp_get_post_terms( $post->ID,"portfolio_category" );
  79. $terms_html_array = array();
  80. $terms_id_array = array();
  81. $term_classes = "";
  82. foreach($terms as $t){
  83. $term_name = $t->name;
  84. $term_link = get_term_link($t->slug,$t->taxonomy);
  85. array_push($terms_html_array,"<a href='{$term_link}'>{$term_name}</a>");
  86. array_push($terms_id_array,$t->slug);
  87. $term_classes .= "um_".$t->slug." ";
  88. }
  89. $terms_html_array = implode(", ",$terms_html_array);
  90. ?>
  91. <div class="column project_block post_block col-sm-6 <?php echo $term_classes; ?>" data-filter='<?php echo implode(" ",$terms_id_array); ?> mix_all'>
  92. <div class="post-thumb">
  93. <a href="<?php the_permalink(); ?>">
  94. <div class="hover-state">
  95. <p class="likes"><i class="icon-heart"></i> <?php echo get_likes(); ?></p>
  96. <p class="cont"><i class="icon-search"></i></p>
  97. </div>
  98. <?php the_post_thumbnail("work_post_medium"); ?>
  99. </a>
  100. </div>
  101. <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
  102. <ul>
  103. <?php if($terms_html_array): ?>
  104. <li><i class='icon-angle-right'></i><?php echo $terms_html_array; ?></li>
  105. <?php endif; ?>
  106. </ul>
  107. </div>
  108. <?php endwhile;wp_reset_postdata(); ?>
  109. </div>
  110. </div>
  111. <?php die();endif;?>
  112. <?php
  113. /*Template Name:Portfolio*/
  114. get_header();
  115. ?>
  116. <div class="container protfolio-page left-space">
  117. <div class="row">
  118. <div class="col-sm-12">
  119. <h5 class="section-title"><?php the_title(); ?></h5>
  120. </div>
  121. </div>
  122. <div class="row">
  123. <div class="col-sm-12 projects-intro">
  124. <h1><?php the_field("page_heading"); ?></h1>
  125. <h4><?php the_field("page_sub_heading"); ?></h4>
  126. </div>
  127. </div>
  128.  
  129. <?php
  130. $cat_arguments = array();
  131. $exlucde_cats = get_field("exclude_categories");
  132. $exlucde_cats_arr = array();
  133. if($exlucde_cats){
  134. foreach($exlucde_cats as $cat){
  135. array_push($exlucde_cats_arr,$cat["category"]->term_id);
  136. }
  137. $cat_arguments["exclude_tree"] = $exlucde_cats_arr;
  138. }
  139. $terms = get_terms("portfolio_category",$cat_arguments);
  140. if($terms):
  141. ?>
  142. <div class="row categories-p">
  143. <ul class="col-sm-12">
  144. <li><a href="#" data-filter="mix_all" class="active"><?php _e("All","um_lang"); ?></a></li>
  145. <?php foreach($terms as $term): ?>
  146. <li><a href="<?php echo get_term_link($term->slug,"portfolio_category"); ?>" data-filter="um_<?php echo $term->slug; ?>"><?php echo $term->name; ?></a></li>
  147. <?php endforeach; ?>
  148. </ul>
  149. </div>
  150. <?php endif; ?>
  151.  
  152. </div>
  153. <div class="projects container left-space">
  154. <div class="col-switcher">
  155. <a href="#" class="col-four project_col_four active"><i class="icon-th"></i></a>
  156. <a href="#" class="col-two project_col_two"><i class="icon-th-large"></i></a>
  157. </div>
  158.  
  159.  
  160. <div class="column-4 row filterable">
  161. <?php
  162. $arguments = array();
  163. $arguments["post_type"] = "portfolio";
  164.  
  165. $exlucde_cats = get_field("exclude_categories");
  166. $exlucde_cats_arr = array();
  167. if($exlucde_cats){
  168. foreach($exlucde_cats as $cat){
  169. array_push($exlucde_cats_arr,$cat["category"]->slug);
  170. }
  171. $arguments["tax_query"] = array(array(
  172. 'taxonomy' => 'portfolio_category',
  173. 'field' => 'slug',
  174. 'terms' => $exlucde_cats_arr,
  175. 'operator' => 'NOT IN'
  176. ));
  177. }
  178.  
  179. $arguments["posts_per_page"] = -1;
  180. $the_query = new WP_Query( $arguments );
  181. while ( $the_query->have_posts() ) : $the_query->the_post();
  182. $terms = wp_get_post_terms( $post->ID,"portfolio_category" );
  183. $terms_html_array = array();
  184. $terms_id_array = array();
  185. $term_classes = "";
  186. foreach($terms as $t){
  187. $term_name = $t->name;
  188. $term_link = get_term_link($t->slug,$t->taxonomy);
  189. array_push($terms_html_array,"<a href='{$term_link}'>{$term_name}</a>");
  190. array_push($terms_id_array,$t->slug);
  191. $term_classes .= "um_".$t->slug." ";
  192. }
  193. $terms_html_array = implode(", ",$terms_html_array);
  194. ?>
  195. <div class="column project_block post_block col-sm-3 mix_all <?php echo $term_classes; ?>" data-filter='<?php echo implode(" ",$terms_id_array); ?> mix_all'>
  196. <div class="post-thumb">
  197. <a href="<?php the_permalink(); ?>">
  198. <div class="hover-state">
  199. <p class="likes"><i class="icon-heart"></i> <?php echo get_likes(); ?></p>
  200. <p class="cont"><i class="icon-search"></i></p>
  201. </div>
  202. <?php the_post_thumbnail("work_post"); ?>
  203. </a>
  204. </div>
  205. <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
  206. <ul>
  207. <?php if($terms_html_array): ?>
  208. <li><i class='icon-angle-right'></i><?php echo $terms_html_array; ?></li>
  209. <?php endif; ?>
  210. </ul>
  211. </div>
  212. <?php endwhile; wp_reset_postdata(); ?>
  213. </div>
  214.  
  215. <div class="column-2 row filterable">
  216. <?php
  217. $arguments = array();
  218. $arguments["post_type"] = "portfolio";
  219.  
  220. $exlucde_cats = get_field("exclude_categories");
  221. $exlucde_cats_arr = array();
  222. if($exlucde_cats){
  223. foreach($exlucde_cats as $cat){
  224. array_push($exlucde_cats_arr,$cat["category"]->slug);
  225. }
  226. $arguments["tax_query"] = array(array(
  227. 'taxonomy' => 'portfolio_category',
  228. 'field' => 'slug',
  229. 'terms' => $exlucde_cats_arr,
  230. 'operator' => 'NOT IN'
  231. ));
  232. }
  233.  
  234. $arguments["posts_per_page"] = -1;
  235. $the_query = new WP_Query( $arguments );
  236. while ( $the_query->have_posts() ) : $the_query->the_post();
  237. $terms = wp_get_post_terms( $post->ID,"portfolio_category" );
  238. $terms_html_array = array();
  239. $terms_id_array = array();
  240. $term_classes = "";
  241. foreach($terms as $t){
  242. $term_name = $t->name;
  243. $term_link = get_term_link($t->slug,$t->taxonomy);
  244. array_push($terms_html_array,"<a href='{$term_link}'>{$term_name}</a>");
  245. array_push($terms_id_array,$t->slug);
  246. $term_classes .= "um_".$t->slug." ";
  247. }
  248. $terms_html_array = implode(", ",$terms_html_array);
  249. ?>
  250. <div class="column project_block post_block col-sm-6 <?php echo $term_classes; ?>" data-filter='<?php echo implode(" ",$terms_id_array); ?> mix_all'>
  251. <div class="post-thumb">
  252. <a href="<?php the_permalink(); ?>">
  253. <div class="hover-state">
  254. <p class="likes"><i class="icon-heart"></i> <?php echo get_likes(); ?></p>
  255. <p class="cont"><i class="icon-search"></i></p>
  256. </div>
  257. <?php the_post_thumbnail("work_post_medium"); ?>
  258. </a>
  259. </div>
  260. <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
  261. <ul>
  262. <?php if($terms_html_array): ?>
  263. <li><i class='icon-angle-right'></i><?php echo $terms_html_array; ?></li>
  264. <?php endif; ?>
  265. </ul>
  266. </div>
  267. <?php endwhile;wp_reset_postdata(); ?>
  268. </div>
  269.  
  270. <div class="col-sm-12 load-more-cont">
  271. <a href="<?php the_permalink(); ?>" class="load-more portfolio_load_more"><?php _e("Load More","um_lang"); ?></a>
  272. </div>
  273.  
  274. </div>
  275. <script type="text/javascript">
  276. jQuery(document).ready(function($){
  277. $(".filterable").mixitup({
  278. targetSelector : "div.project_block",
  279. filterLogic : "and",
  280. multiFilter : true,
  281. animation : false
  282. });
  283. });
  284. project_page = 1;
  285. </script>
  286. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement