This repository has been archived on 2024-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
kspace-wordpress-theme/components/sidebar/categories.php

33 lines
1 KiB
PHP
Raw Permalink Normal View History

2023-03-12 16:15:46 +01:00
<?php
$parent_categories = get_categories( array(
'orderby' => 'slug',
'order' => 'ASC',
'parent' => 0
) );
2023-03-12 16:15:46 +01:00
foreach( $parent_categories as $parent_category ) {
?>
2023-05-20 15:05:12 +02:00
<section class="card head-primary d-none d-flex-sm">
2023-11-18 12:17:07 +01:00
<h2 class="card-header"><svg class='icon' alt=''><use xlink:href='#icon-folder'></use></svg> <?php echo $parent_category->name ?></h2>
<div class="menu fg-dark">
<ul>
<?php
$categories = get_categories( array(
'orderby' => 'slug',
'order' => 'ASC',
'parent' => $parent_category->term_id
) );
2023-03-12 16:15:46 +01:00
foreach( $categories as $category ) {
if ($category->slug != "chapters") {
echo '<li><a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '<span class="badge bg-secondary">'. $category->count . '</span></a></li>';
}
}
?>
</ul>
</div>
</section>
2023-03-12 16:15:46 +01:00
<?php
}
?>