Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.43 KB | None | 0 0
  1. <?php
  2. get_header();
  3. $simpleCats = array(26,24,20,19,4,9,10,23,27,8,22,21,25,18);
  4. $doorsCats = array(3,11,12,14,17,15,16,24,37,38,59,60,62);
  5. $rectangleCats = array(27,44,43,45,4,57,49,48,47);
  6. ?>
  7.  
  8. <div class="twoColumn">
  9. <div class="inner">
  10. <div class="rightColumn">
  11. <?php
  12. $current = get_queried_object();
  13. if (!empty($current)) {
  14. $classes = get_tax_meta((int)$current->term_id, 'safety_class');
  15. if (!empty($classes)) {
  16. $classes = explode(',', $classes);
  17. if (is_array($classes)) {
  18. foreach($classes as $key => $val)
  19. $classes[$key] = trim($val);
  20. }
  21. }
  22. ?>
  23. <div class="listDescription">
  24. <h1>
  25. <?php echo $current->name; ?>
  26. <?php
  27. if (!empty($classes) and is_array($classes)) {
  28. ?>
  29. <small>(<?php
  30. $i = 0;
  31. $c = count($classes);
  32. foreach ($classes as $class) {
  33. $i++;
  34. echo '<span class="'.strtolower($class).'">'.$class.'</span>'.(($i !== $c) ? ', ' : null);
  35. }
  36. ?>)</small>
  37. <?php
  38. }
  39. unset($classes, $i);
  40. ?>
  41. </h1>
  42. <?php if ($current->description) { $desc = explode('{dropdown}', $current->description); ?>
  43. <div class="desc">
  44. <?php
  45. if(isset($desc[1]) and $desc[1]) {
  46. echo apply_filters('the_content', $desc[1]);
  47. } else {
  48. echo apply_filters('the_content', $desc[0]);
  49. }
  50. ?>
  51. </div>
  52. <?php } ?>
  53. </div>
  54. <?php } ?>
  55.  
  56. <?php //if(!in_array($current->term_id, $simpleCats)) { ?>
  57. <div class="czechmadeBox">
  58. <p><?php _e('Objednáte-li si výrobek s tímto označením, dostanete výrobek s vysokou užitnou hodnotou a se zpracováním ve vysoké kvalitě. Zakoupením výrobku podpoříte rozvoj našeho hospodářství.', 'kavan'); ?></p>
  59. </div>
  60. <!-- <div class="labelDescription">
  61. <div class="label"><?php _e('Vysvětlivky ikon', 'kavan'); ?></div>
  62. <span class="label-rc2"><?php _e('Bezpečnostní třída 2', 'kavan'); ?></span>
  63. <span class="label-rc3"><?php _e('Bezpečnostní třída 3', 'kavan'); ?></span>
  64. <span class="label-rc4"><?php _e('Bezpečnostní třída 4', 'kavan'); ?></span>
  65. <span class="label-firered"><?php _e('Požární odolnost daná', 'kavan'); ?></span>
  66. <span class="label-fireblue"><?php _e('Požární odolnost volitelná', 'kavan'); ?></span>
  67. <span class="label-panika"><?php _e('Paniková funkce', 'kavan'); ?></span>
  68. <span class="label-elektro"><?php _e('Elektronické ovládání', 'kavan'); ?></span>
  69. </div> -->
  70. <?php //} ?>
  71. <?php
  72. $councils = get_tax_meta((int)$current->term_id, 'councils_cat');
  73. if (!empty($councils)) {
  74. $councils = get_posts(array('post_type' => 'post', 'category' => $councils, 'showposts' => -1));
  75. if (!empty($councils)) {
  76.  
  77. ?>
  78. <div class="advicesBox">
  79. <h2 class="header">Poradník</h2>
  80. <ul>
  81. <?php
  82. foreach ($councils as $council) {
  83. if (!empty($council->post_content) and !empty($council->post_title)) {
  84.  
  85. }
  86. ?>
  87. <li class="item">
  88. <h3 class="question"><?php echo $council->post_title; ?></h3>
  89. <div class="answer">
  90. <?php
  91. echo apply_filters('the_content', $council->post_content);
  92. ?>
  93. </div>
  94. </li>
  95. <?php
  96. }
  97. ?>
  98. </ul>
  99. </div>
  100. <?php
  101. }
  102. }
  103. unset($councils, $councils_more);
  104. ?>
  105.  
  106.  
  107. <div class="productList<?php if(in_array($current->term_id, $simpleCats)) { echo ' simple'; }?>">
  108.  
  109. <?php if (have_posts()): ?>
  110.  
  111. <?php
  112. while(have_posts()):the_post();
  113. $type = get_post_meta($post->ID, 'product_type', true);
  114. $icons = get_post_meta($post->ID, 'product_icons', true);
  115. $params_1 = get_post_meta($post->ID, 'product_params_1', true);
  116. $params_2 = get_post_meta($post->ID, 'product_params_2', true);
  117. $gallery = get_post_meta($post->ID, 'product_gallery', true);
  118.  
  119. if(count($icons) > 3){
  120. if(count($icons) == 4) $padding = 'icons-4';
  121. if(count($icons) == 5) $padding = 'icons-5';
  122. if(count($icons) >= 6) $padding = 'icons-6';
  123. }
  124. ?>
  125.  
  126. <div class="product<?php if(in_array($current->term_id, $doorsCats)) {echo ' door';} if(in_array($current->term_id, $rectangleCats)) {echo ' rectangle';} if (!empty($type)) { echo ' type';}?>">
  127. <h2 class="name <?php if(count($icons) > 3) echo $padding ?>"><a href="<?php the_permalink(); ?>"><?php echo preg_replace('/<span[^>]*class=\"hide\">(.*?)<\\/span>/si','',get_the_title()); ?></a></h2>
  128. <?php
  129. if (!empty($type)) {
  130. echo '<div class="id">'.$type.'</div>';
  131. }
  132. ?>
  133. <?php if (!empty($post->post_excerpt)) { ?>
  134. <p class="subname"><?php echo str_replace(array('[b]', '[/b]'), array('<span>', '</span>'), $post->post_excerpt); ?></p>
  135. <?php } ?>
  136. <?php if (!empty($params_1) and is_array($params_1)) { ?>
  137. <div class="desc">
  138. <?php
  139. foreach ($params_1 as $param) {
  140. if (Helper::isGood($param, 'title') and Helper::isGood($param, 'desc')) {
  141. ?>
  142. <p><?php echo $param['title']; ?>: <?php echo str_replace(array('[b]', '[/b]'), array('<strong>', '</strong>'), $param['desc']); ?></p>
  143. <?php
  144. }
  145. }
  146. ?>
  147. </div>
  148. <?php } ?>
  149. <?php
  150. if(in_array($current->term_id, $doorsCats)) {
  151. $i = 0;
  152. if (has_post_thumbnail()) { ?>
  153. <a href="<?php the_permalink(); ?>" class="image">
  154. <?php the_post_thumbnail('180x300_true'); ?>
  155. </a>
  156. <?php $i++; } ?>
  157. <?php
  158. if (!empty($gallery) and is_array($gallery)) {
  159.  
  160. foreach ($gallery as $url) {
  161. $thumb_id = get_media_by_url($url);
  162. if ($thumb_id) {
  163. $i++;
  164. echo '<a href="'.get_the_permalink().'" class="image">
  165. '.wp_get_attachment_image($thumb_id, '180x300_true').'
  166. </a>';
  167. }
  168. if($i==3) break;
  169. }
  170. }
  171. ?>
  172. <?php }else if(in_array($current->term_id, $rectangleCats)){
  173. if (has_post_thumbnail()) { ?>
  174. <a href="<?php the_permalink(); ?>" class="image">
  175. <?php the_post_thumbnail('180x300_true'); ?>
  176. </a>
  177. <?php }
  178. } else{
  179. if (has_post_thumbnail()) { ?>
  180. <a href="<?php the_permalink(); ?>" class="image">
  181. <?php the_post_thumbnail('180x180_true'); ?>
  182. </a>
  183. <?php }
  184. } ?>
  185. <?php if (!empty($icons) and is_array($icons)) { ?>
  186. <div class="labels">
  187. <?php
  188. foreach ($icons as $icon) {
  189. echo '<span class="label-'.$icon.'"><i>'. $_GLOBALS['product_labels'][$icon] .'</i></span>';
  190. }
  191. ?>
  192. </div>
  193. <?php } ?>
  194. <?php if (!empty($params_2) and is_array($params_2)) { ?>
  195. <ul class="highlights">
  196. <?php foreach ($params_2 as $param) { ?>
  197. <li><?php echo $param; ?></li>
  198. <?php } ?>
  199. </ul>
  200. <?php } ?>
  201. <div class="clear"></div>
  202. <a href="<?php the_permalink(); ?>" class="button rounded"><?php _e('Podrobnosti'); ?></a>
  203. <a href="<?php the_permalink(); ?>#kontakt" class="button rounded inverted"><?php _e('Poptat'); ?></a>
  204. <div style="display:block;clear:both;"></div>
  205. </div>
  206. <?php endwhile; ?>
  207.  
  208. <?php else: ?>
  209. <div class="flashMessage colorRed" style="margin-top:30px;"><?php _e('Je nám líto, ale v této kategorii nebyli žádné produkty nalezeny.'); ?></div>
  210. <?php endif; ?>
  211. </div>
  212.  
  213.  
  214. </div>
  215. <?php get_sidebar(); ?>
  216. </div>
  217. </div>
  218.  
  219. <div class="contactForm">
  220. <div class="inner">
  221. <h2><?php _e('Kontaktní formulář', 'kavan'); ?></h2>
  222. <?php echo do_shortcode('[contact-form-7 id="44"]'); ?>
  223. </div>
  224. </div>
  225.  
  226. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement