$countsettings = esc_attr( $_REQUEST['count_section'] );
$args = array(
'post_type' => 'glm-panel',
- 'cat' => 'panel',
'posts_per_page' => -1
);
$count_service = 0;
$panels= new WP_Query($args);
+ $panels = $panels->posts;
?>
<div class="sub-option clearfix" data-id="<?php echo $countsettings; ?>">
<?php if(!empty($sections)):
$count = 0;
- foreach ($sections as $section) :
- $page = get_post( $section['page'] );
+ foreach ($sections as $section) :
+ $categories = [];
+ $page = get_post( $section['page'] );
+ // print_r($page);
$overlay = $section['overlay'];
$image = $section['image'];
$layout = $section['layout'];
$category = $section['category'];
- $googlemapclass = $layout == "googlemap_template" ? " google-map" : "";
+ $googlemapclass = $layout == "googlemap_template" ? " google-map" : "";
+
+ $terms = get_the_terms( $page->ID , 'panel_category' );
+ foreach($terms as $term){
+ $categories[] = $term->term_id;
+ }
?>
-
+
<?php if(!empty($section['page'])): ?>
<section class="parallax-section clearfix<?php echo esc_attr($googlemapclass)." ".esc_attr($layout); ?>" id="<?php echo "section-".absint($page->ID); ?>">
<?php if(!empty($image) && $overlay != "overlay0") : ?>
<?php if($layout != "googlemap_template") :?>
<div class="mid-content">
<?php endif; ?>
- <?php
- $args = array(
+ <?php
+
+ $args = array(
'post_type' => 'glm-panel',
- 'posts_per_page' => -1
- );
+ 'posts_per_page' => -1,
+ 'tax_query' => array(
+ array(
+ 'taxonomy' => 'panel_category',
+ 'field' => 'term_id',
+ 'terms' => $categories
+ )
+ )
+ );
$count_service = 0;
$query = new WP_Query($args);
while ( $query->have_posts() ) : $query->the_post();