fixing the donate form fund search field population
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 27 Jun 2017 17:14:19 +0000 (13:14 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 27 Jun 2017 17:14:19 +0000 (13:14 -0400)
needed to add -1 numberposts to the get terms args array when getting the funds list
for jquery

functions.php

index 167e677..8346806 100644 (file)
@@ -146,23 +146,27 @@ add_action('thematic_searchloop', 'mytheme_search_loop');
 
 add_action('init', function(){
     function get_funds(){
+        $all_funds = [];
         $custom_terms = get_terms('fund_group');
         foreach($custom_terms as $custom_term) {
             wp_reset_query();
-            $args = array('post_type' => 'fund',
+            $args = array(
+                'post_type' => 'fund',
+                'numberposts' => -1,
                 'tax_query' => array(
                     array(
                         'taxonomy' => 'fund_group',
                         'field' => 'slug',
                         'terms' => $custom_term->slug,
-                    ),
+                        'hide_empty' => false
+                     ),
                 ),
              );
 
             $loop = get_posts($args);
             foreach($loop as $l){
                 $funds_grouped[$custom_term->name][] = $l->post_title;
-                $all_funds[] = $l->post_title;
+                $all_funds[]= $l->post_title;
             }
         }