fixing the categories for the front page parallax sections
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 10 May 2018 18:34:04 +0000 (14:34 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 10 May 2018 18:34:04 +0000 (14:34 -0400)
inc/accesspress-options.php
inc/ajax.php
index-parallax.php
layouts/service-section.php

index d21a172..686dfd7 100644 (file)
@@ -71,7 +71,7 @@ function optionsframework_options() {
        foreach ( $options_tags_obj as $tag ) {
                $options_tags[$tag->term_id] = $tag->name;
        }
-
+    
     $args = array(
         'post_type' => 'glm-panel',
         'posts_per_page' => -1
index b95f337..0525fa6 100644 (file)
     $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; ?>">
index 2d0116f..a4d6648 100644 (file)
     
     <?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();
index 1921b58..5f93200 100644 (file)
@@ -18,7 +18,7 @@
                     'terms' => $category
                 )
              )
-                       );
+               );
                $count_service = 0;
         $query = new WP_Query($args);
                if($query->have_posts()):