Facebook
From Corrupt Cassowary, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 175
  1. <?php /**
  2.  */
  3.  
  4. get_header(); ?>
  5.  
  6. <?php get_template_part('template-parts/top-banner'); ?>
  7.  
  8. <section class="offer-primary set-1">
  9.     <div class="container">
  10.         <div class="offer-primary_wrapper">
  11.             <div class="offer-primary_aside">
  12.                 <div class="offer-sidebar">
  13.                     <div class="offer-sidebar_header">
  14.                         <div class="offer-sidebar_header-logo">
  15.                             <img src="<?php the_field('products-list-logo'); ?>" alt="KAROL" />
  16.                         </div>
  17.                     </div>
  18.                     <?php
  19.                    
  20.                     $terms = get_terms(
  21.                         array(
  22.                             'taxonomy'   => 'oferta',
  23.                             'hide_empty' => false,
  24.                         )
  25.                     );
  26.  
  27.                     ?>
  28.                     <ul class="offer-nav">
  29.                         <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
  30.                             foreach ( $terms as $term ) {
  31.  
  32.                                 if( isset($_GET[$term->name]) ) { ?>
  33.                         <script>
  34.                         $(document).ready(function() {
  35.                             var openActive = '<?php echo $term->name; ?>';
  36.                             $("." + openActive).addClass("open active");
  37.                             $("." + openActive + " .offer-nav-collapse").css("display", "block");
  38.                             $("." + openActive + " .offer-nav-collapse").css("height", "auto");
  39.                         });
  40.                         </script>
  41.                         <li class="<?php echo $term->name; ?>">
  42.                             <?php
  43.                                 } else { ?>
  44.                             <script>
  45.                             var openActive = '<?php echo $term->name; ?>';
  46.                             if (!$("." + openActive).hasClass("open")) {
  47.                                 $("." + openActive).removeClass("active")
  48.                             }
  49.                             </script>
  50.                         <li>
  51.                             <?php } ?>
  52.                             <form action="<?php the_permalink(292); ?>" method="get">
  53.                                 <input type="submit" name="<?php echo $term->name; ?>"
  54.                                     placeholder="<?php echo $term->name; ?>" value="<?php echo $term->name; ?>">
  55.                                 <span class="offer-nav_toggle"><i class="fa fa-caret-down"
  56.                                         aria-hidden="true"></i></span>
  57.                             </form>
  58.                             <div class="offer-nav-collapse">
  59.                                 <ul class="offer-subnav">
  60.                                     <?php
  61.                                 $wp_query = new WP_Query(          
  62.                                     array(
  63.                                         'posts_per_page' => -1,
  64.                                         'post_type' => 'produkty',
  65.                                         'oferta' => $term->name,
  66.                                     )
  67.                                 );
  68.  
  69.                                 if(  $wp_query->have_posts()) {
  70.                                     while(  $wp_query->have_posts()) {  $wp_query->the_post();
  71.                                     $produkty = get_the_terms( $post->ID, 'oferta'); ?>
  72.                                     <li>
  73.                                         <form action="<?php the_permalink(); ?>" method="get">
  74.                                             <button class="product-btn" name="<?php echo $term->name; ?>"
  75.                                                 value="<?php echo $term->slug; ?>" type="submit">
  76.                                                 <?php the_title(); ?>
  77.                                             </button>
  78.                                         </form>
  79.                                         <!-- <a href="offer-single.php"><?php the_title(); ?></a> -->
  80.                                     </li>
  81.                                     <?php
  82.                                     }
  83.                                 }
  84.                                 ?>
  85.                                 </ul>
  86.                             </div>
  87.                         </li>
  88.                         <?php
  89.                             }
  90.                             wp_reset_query();
  91.                             wp_reset_postdata();
  92.                         }
  93.                         ?>
  94.                     </ul>
  95.                     <div class="offer-sidebar_footer">
  96.                         <div class="offer-sidebar_footer-logo">
  97.                             <img src="<?php the_field('products-img'); ?>" />
  98.                         </div>
  99.                     </div>
  100.                 </div>
  101.             </div>
  102.             <div class="offer-primary_content">
  103.                 <ul class="offer-pagination">
  104.                     <li>
  105.                         <a href="offer.php">OFERTA</a>
  106.                     </li>
  107.                     <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
  108.                         foreach ( $terms as $term ) {
  109.                             if( isset($_GET[$term->name]) ) {?>
  110.  
  111.                     <li>
  112.                         <span class="current-page"><?php echo $term->name; ?></span>
  113.                     </li>
  114.                     <?php
  115.                         }
  116.                     }
  117.                     } ?>
  118.                 </ul>
  119.                 <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
  120.                         foreach ( $terms as $term ) {
  121.                             if( isset($_GET[$term->name]) ) { ?>
  122.                 <div class="offer-info_box">
  123.                     <?php echo $term->description ;?>
  124.                 </div>
  125.                 <?php
  126.                             }
  127.                         }
  128.                     }
  129.                 ?>
  130.                 <div class="offer-items_grid">
  131.                     <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
  132.                         foreach ( $terms as $term ) {
  133.                        
  134.                             $wp_query = new WP_Query(          
  135.                                 array(
  136.                                     'posts_per_page' => -1,
  137.                                     'post_type' => 'produkty',
  138.                                     'oferta' => $_GET[$term->name],
  139.                                 )
  140.                             );
  141.  
  142.                             if(  $wp_query->have_posts()) {
  143.                                 while(  $wp_query->have_posts()) {  $wp_query->the_post();
  144.                                 $produkty = get_the_terms( $post->ID, 'oferta');  
  145.                                
  146.                                     if( isset($_GET[$term->name]) ) {
  147.                                     ?>
  148.  
  149.                     <div>
  150.                         <div class="offer-item">
  151.                             <h3 class="offer-item_title"><?php echo get_the_title(); ?></h3>
  152.                             <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
  153.                             <div class="offer-item_thumbnail">
  154.                                 <img src="<?php echo $url; ?>" />
  155.                             </div>
  156.                             <div class="offer-item_content">
  157.                                 <?php echo get_the_excerpt(); ?>
  158.                             </div>
  159.                             <div class="offer-item_link">
  160.  
  161.  
  162.                                 <form action="<?php the_permalink(); ?>" method="get">
  163.                                     <button class="miesny-link" name="<?php echo $term->name; ?>"
  164.                                         value="<?php echo $term->slug; ?>" type="submit">
  165.                                         WIĘCEJ
  166.                                     </button>
  167.                                 </form>
  168.                                 <!-- <a class="miesny-link" href="<?php the_permalink(); ?>">WIĘCEJ</a> -->
  169.                             </div>
  170.                             <div class="offer-item_logo"></div>
  171.                         </div>
  172.                     </div>
  173.                     <?php
  174.                                     }
  175.                                 }
  176.                             }
  177.                         }
  178.                     }
  179.                     ?>
  180.                 </div>
  181.             </div>
  182.         </div>
  183.         <a class="offer-sidebar_toggle"><i class="fa fa-level-down" aria-hidden="true"></i></a>
  184.     </div>
  185. </section>
  186.  
  187. <?php get_template_part('template-parts/our-offer'); ?>
  188. <?php get_footer();
  189.  ?>