function wbmz_extra_products() {
  $queried_object = get_queried_object();
  $taxonomy = $queried_object->taxonomy;
  $term_id = $queried_object->term_id;
  $best_getest_tonen = get_field('best_getest_tonen' , $taxonomy . '_' . $term_id);
  $producten_best_getest = get_field('producten_best_getest' , $taxonomy . '_' . $term_id);
  $titel_best_getest = get_field('titel_best_getest' , $taxonomy . '_' . $term_id);
  $best_verkocht_tonen = get_field('best_verkocht_tonen' , $taxonomy . '_' . $term_id);
  $producten_best_verkocht = get_field('producten_best_verkocht' , $taxonomy . '_' . $term_id);
  $titel_best_verkocht = get_field('titel_best_verkocht' , $taxonomy . '_' . $term_id);
  $beste_budget_tonen = get_field('beste_budget_tonen' , $taxonomy . '_' . $term_id);
  $producten_beste_budget = get_field('producten_beste_budget' , $taxonomy . '_' . $term_id);
  $titel_beste_budget = get_field('titel_beste_budget' , $taxonomy . '_' . $term_id);
  if($best_getest_tonen || $best_verkocht_tonen || $beste_budget_tonen):?>
  <div class="col-12">
    <div class="row sldrcts" style="margin-left: -30px; margin-right: -30px; padding-top: 15px;">
      <?php if($best_getest_tonen):
        $args = array(
          'post_type' => 'product',
          'p' => $producten_best_getest,
        );
        $best_getest = new WP_Query( $args );
        while ( $best_getest->have_posts() ) : $best_getest->the_post(); ?>
        <div class="col-12 col-md-4">
          <h2 style="color: #00c0f5;"><?php echo $titel_best_getest; ?></h2>
          <ul class="products columns-1">
            <?php echo wc_get_template_part('content', 'product'); ?>
          </ul>
        </div>
        <?php endwhile; wp_reset_query(); endif;
        if($best_verkocht_tonen):
        $args = array(
          'post_type' => 'product',
          'p' => $producten_best_verkocht,
        );
        $best_verkocht = new WP_Query( $args );
          while ( $best_verkocht->have_posts() ) : $best_verkocht->the_post(); ?>
          <div class="col-12 col-md-4">
            <h2 style="color: #00c0f5;"><?php echo $titel_best_verkocht; ?></h2>
            <ul class="products columns-1">
              <?php echo wc_get_template_part('content', 'product'); ?>
            </ul>
          </div>
          <?php endwhile; wp_reset_query(); endif;
          if($beste_budget_tonen):
            $args = array(
            'post_type' => 'product',
            'p' => $producten_beste_budget,
          );
          $beste_budget = new WP_Query( $args );
          while ( $beste_budget->have_posts() ) : $beste_budget->the_post(); ?>
          <div class="col-12 col-md-4">
            <h2 style="color: #00c0f5;"><?php echo $titel_beste_budget; ?></h2>
            <ul class="products columns-1">
              <?php echo wc_get_template_part('content', 'product'); ?>
            </ul>
          </div>
            <?php endwhile; wp_reset_query(); endif; ?>
  </div>
  </div>
<?php endif;
}

Geef een reactie 0