- <?php /**
- */
- get_header(); ?>
- <?php get_template_part('template-parts/top-banner'); ?>
- <section class="offer-primary set-1">
- <div class="container">
- <div class="offer-primary_wrapper">
- <div class="offer-primary_aside">
- <div class="offer-sidebar">
- <div class="offer-sidebar_header">
- <div class="offer-sidebar_header-logo">
- <img src="<?php the_field('products-list-logo'); ?>" alt="KAROL" />
- </div>
- </div>
- <?php
- $terms = get_terms(
- array(
- 'taxonomy' => 'oferta',
- 'hide_empty' => false,
- )
- );
- ?>
- <ul class="offer-nav">
- <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- if( isset($_GET[$term->name]) ) { ?>
- <script>
- $(document).ready(function() {
- var openActive = '<?php echo $term->name; ?>';
- $("." + openActive).addClass("open active");
- $("." + openActive + " .offer-nav-collapse").css("display", "block");
- $("." + openActive + " .offer-nav-collapse").css("height", "auto");
- });
- </script>
- <li class="<?php echo $term->name; ?>">
- <?php
- } else { ?>
- <script>
- var openActive = '<?php echo $term->name; ?>';
- if (!$("." + openActive).hasClass("open")) {
- $("." + openActive).removeClass("active")
- }
- </script>
- <li>
- <?php } ?>
- <form action="<?php the_permalink(292); ?>" method="get">
- <input type="submit" name="<?php echo $term->name; ?>"
- placeholder="<?php echo $term->name; ?>" value="<?php echo $term->name; ?>">
- <span class="offer-nav_toggle"><i class="fa fa-caret-down"
- aria-hidden="true"></i></span>
- </form>
- <div class="offer-nav-collapse">
- <ul class="offer-subnav">
- <?php
- $wp_query = new WP_Query(
- array(
- 'posts_per_page' => -1,
- 'post_type' => 'produkty',
- 'oferta' => $term->name,
- )
- );
- if( $wp_query->have_posts()) {
- while( $wp_query->have_posts()) { $wp_query->the_post();
- $produkty = get_the_terms( $post->ID, 'oferta'); ?>
- <li>
- <form action="<?php the_permalink(); ?>" method="get">
- <button class="product-btn" name="<?php echo $term->name; ?>"
- value="<?php echo $term->slug; ?>" type="submit">
- <?php the_title(); ?>
- </button>
- </form>
- <!-- <a href="offer-single.php"><?php the_title(); ?></a> -->
- </li>
- <?php
- }
- }
- ?>
- </ul>
- </div>
- </li>
- <?php
- }
- wp_reset_query();
- wp_reset_postdata();
- }
- ?>
- </ul>
- <div class="offer-sidebar_footer">
- <div class="offer-sidebar_footer-logo">
- <img src="<?php the_field('products-img'); ?>" />
- </div>
- </div>
- </div>
- </div>
- <div class="offer-primary_content">
- <ul class="offer-pagination">
- <li>
- <a href="offer.php">OFERTA</a>
- </li>
- <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- if( isset($_GET[$term->name]) ) {?>
- <li>
- <span class="current-page"><?php echo $term->name; ?></span>
- </li>
- <?php
- }
- }
- } ?>
- </ul>
- <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- if( isset($_GET[$term->name]) ) { ?>
- <div class="offer-info_box">
- <?php echo $term->description ;?>
- </div>
- <?php
- }
- }
- }
- ?>
- <div class="offer-items_grid">
- <?php if ( ! empty( $terms ) && is_array( $terms ) ) {
- foreach ( $terms as $term ) {
- $wp_query = new WP_Query(
- array(
- 'posts_per_page' => -1,
- 'post_type' => 'produkty',
- 'oferta' => $_GET[$term->name],
- )
- );
- if( $wp_query->have_posts()) {
- while( $wp_query->have_posts()) { $wp_query->the_post();
- $produkty = get_the_terms( $post->ID, 'oferta');
- if( isset($_GET[$term->name]) ) {
- ?>
- <div>
- <div class="offer-item">
- <h3 class="offer-item_title"><?php echo get_the_title(); ?></h3>
- <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
- <div class="offer-item_thumbnail">
- <img src="<?php echo $url; ?>" />
- </div>
- <div class="offer-item_content">
- <?php echo get_the_excerpt(); ?>
- </div>
- <div class="offer-item_link">
- <form action="<?php the_permalink(); ?>" method="get">
- <button class="miesny-link" name="<?php echo $term->name; ?>"
- value="<?php echo $term->slug; ?>" type="submit">
- WIĘCEJ
- </button>
- </form>
- <!-- <a class="miesny-link" href="<?php the_permalink(); ?>">WIĘCEJ</a> -->
- </div>
- <div class="offer-item_logo"></div>
- </div>
- </div>
- <?php
- }
- }
- }
- }
- }
- ?>
- </div>
- </div>
- </div>
- <a class="offer-sidebar_toggle"><i class="fa fa-level-down" aria-hidden="true"></i></a>
- </div>
- </section>
- <?php get_template_part('template-parts/our-offer'); ?>
- <?php get_footer();
- ?>