fixing the category selection for parallax types
authorAnthony Talarico <talarico@gaslightmedia.com>
Thu, 10 May 2018 16:49:32 +0000 (12:49 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Thu, 10 May 2018 16:49:32 +0000 (12:49 -0400)
inc/accesspress-options.php
layouts/portfolio-section.php
layouts/service-section.php

index 9f374c7..121a3b9 100644 (file)
@@ -54,13 +54,15 @@ function optionsframework_options() {
        // Parallax Defaults
        $parallax_defaults = NULL;
 
-    
+    $taxonomy = 'parallax_posts_category';
+    $terms = get_terms($taxonomy);
+    // print_r($terms);
        // Pull all the categories into an array
        $options_categories = array();
-       $options_categories_obj = get_categories();
+       $options_categories_obj = $terms;
        $options_categories[''] = 'Select a Category:';
        foreach ($options_categories_obj as $category) {
-               $options_categories[$category->cat_ID] = $category->cat_name;
+               $options_categories[$category->term_id] = $category->name;
        }
 
        // Pull all tags into an array
index 5057139..8568656 100644 (file)
@@ -15,7 +15,6 @@
                        );
                
         $query = new WP_Query($args);
-        print_r($query);
                if($query->have_posts()):
                        $i = 0;
                        while($query->have_posts()): $query->the_post();
index 7ae1c91..1921b58 100644 (file)
@@ -4,17 +4,23 @@
  *
  * @package accesspress_parallax
  */
-?>
+?>  
 
        <div class="service-listing clearfix">
-       <?php 
+    <?php 
                $args = array(
             'post_type'         => 'glm-parallax',
-                       'cat'               => 'parallax',
-                       'posts_per_page'    => -1
+            'posts_per_page'    => -1,
+            'tax_query' => array(
+                array(
+                    'taxonomy' => 'parallax_posts_category',
+                    'field' => 'term_id',
+                    'terms' => $category
+                )
+             )
                        );
                $count_service = 0;
-               $query = new WP_Query($args);
+        $query = new WP_Query($args);
                if($query->have_posts()):
                        $i = 0;
             while ($query->have_posts()): $query->the_post();