70fc07a7 by Jeremy Groot

fix to resources and favs

1 parent 14ac73ec
......@@ -151,9 +151,13 @@ function resources_list($atts){
<table id="resources" class='hidden'>
<thead><tr><th class="hidden"></th><th></th><th class="hidden"></th></tr></thead>
<tbody>
<?php while ($custom_query->have_posts()):
<?php while ($custom_query->have_posts()):
$custom_query->the_post();
if(is_array($favs)) {
$is_fav = in_array(get_the_ID(), $favs);
} else {
$is_fav = false;
}
echo resources(get_the_ID(), $organized_term_filter, $is_fav);
endwhile; ?>
</tbody>
......@@ -179,9 +183,9 @@ function resources_fav(){
ob_start();
if (is_array( $favs)): ?>
?>
<div class="course-list resources">
<?php if(count($favs) > 0) { ?>
<?php if(is_array( $favs) && count($favs) > 0) { ?>
<table id="resources" class="resources-fav">
<thead><tr><th class="hidden"></th><th class="hidden"></th><th></th></tr></thead>
<tbody>
......@@ -195,7 +199,7 @@ function resources_fav(){
<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>
<?php } ?>
</div>
<?php endif;
<?php
wp_reset_query();
$output = ob_get_clean();
return $output;
......@@ -245,13 +249,14 @@ function resources($id, $taxes, $is_fav = false){
$categories = array_merge($categories, $terms);
}
}
// var_dump($categories);exit;
$cat ="";
if(is_array( $categories)){
foreach( $categories as $category ) {
if($category->parent == $tax){
// if($category->parent == $tax){
// var_dump($category);exit;
$cat .= " ".$category->slug;
}
// }
};
} ?>
......