70fc07a7 by Jeremy Groot

fix to resources and favs

1 parent 14ac73ec
...@@ -151,9 +151,13 @@ function resources_list($atts){ ...@@ -151,9 +151,13 @@ function resources_list($atts){
151 <table id="resources" class='hidden'> 151 <table id="resources" class='hidden'>
152 <thead><tr><th class="hidden"></th><th></th><th class="hidden"></th></tr></thead> 152 <thead><tr><th class="hidden"></th><th></th><th class="hidden"></th></tr></thead>
153 <tbody> 153 <tbody>
154 <?php while ($custom_query->have_posts()): 154 <?php while ($custom_query->have_posts()):
155 $custom_query->the_post(); 155 $custom_query->the_post();
156 if(is_array($favs)) {
156 $is_fav = in_array(get_the_ID(), $favs); 157 $is_fav = in_array(get_the_ID(), $favs);
158 } else {
159 $is_fav = false;
160 }
157 echo resources(get_the_ID(), $organized_term_filter, $is_fav); 161 echo resources(get_the_ID(), $organized_term_filter, $is_fav);
158 endwhile; ?> 162 endwhile; ?>
159 </tbody> 163 </tbody>
...@@ -179,9 +183,9 @@ function resources_fav(){ ...@@ -179,9 +183,9 @@ function resources_fav(){
179 183
180 ob_start(); 184 ob_start();
181 185
182 if (is_array( $favs)): ?> 186 ?>
183 <div class="course-list resources"> 187 <div class="course-list resources">
184 <?php if(count($favs) > 0) { ?> 188 <?php if(is_array( $favs) && count($favs) > 0) { ?>
185 <table id="resources" class="resources-fav"> 189 <table id="resources" class="resources-fav">
186 <thead><tr><th class="hidden"></th><th class="hidden"></th><th></th></tr></thead> 190 <thead><tr><th class="hidden"></th><th class="hidden"></th><th></th></tr></thead>
187 <tbody> 191 <tbody>
...@@ -195,7 +199,7 @@ function resources_fav(){ ...@@ -195,7 +199,7 @@ function resources_fav(){
195 <p><?= _("Your Favourites List is where you can add the manuals and forms that you use most. To start adding to your list, simply tap on the heart beside any resource listed in the Manuals and Forms page.") ?></p> 199 <p><?= _("Your Favourites List is where you can add the manuals and forms that you use most. To start adding to your list, simply tap on the heart beside any resource listed in the Manuals and Forms page.") ?></p>
196 <?php } ?> 200 <?php } ?>
197 </div> 201 </div>
198 <?php endif; 202 <?php
199 wp_reset_query(); 203 wp_reset_query();
200 $output = ob_get_clean(); 204 $output = ob_get_clean();
201 return $output; 205 return $output;
...@@ -245,13 +249,14 @@ function resources($id, $taxes, $is_fav = false){ ...@@ -245,13 +249,14 @@ function resources($id, $taxes, $is_fav = false){
245 $categories = array_merge($categories, $terms); 249 $categories = array_merge($categories, $terms);
246 } 250 }
247 } 251 }
248 252 // var_dump($categories);exit;
249 $cat =""; 253 $cat ="";
250 if(is_array( $categories)){ 254 if(is_array( $categories)){
251 foreach( $categories as $category ) { 255 foreach( $categories as $category ) {
252 if($category->parent == $tax){ 256 // if($category->parent == $tax){
257 // var_dump($category);exit;
253 $cat .= " ".$category->slug; 258 $cat .= " ".$category->slug;
254 } 259 // }
255 }; 260 };
256 } ?> 261 } ?>
257 262
......