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/navbar-category.php

34 lines
873 B
PHP
Raw 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 ) {
?>
<li>
<span class="btn btn-navbar">
<?php echo $parent_category->name ?> <i class="fa fa-caret-down" aria-hidden="true"></i>
2023-03-12 16:15:46 +01:00
<ul class="card-menu">
<?php
$categories = get_categories( array(
'orderby' => 'slug',
'order' => 'ASC',
'parent' => $parent_category->term_id
) );
foreach( $categories as $category ) {
if ($category->slug != "chapters") {
echo '<li><a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a></li>';
}
}
?>
</ul>
</span>
</li>
<?php
}
?>