feat: show blog category in navbar

Fixes #1
This commit is contained in:
Kazhnuz 2020-12-31 12:33:38 +01:00
parent 1878ab7866
commit 8b9b2afe94
2 changed files with 14 additions and 1 deletions

View file

@ -1,4 +1,15 @@
<div class="navbar-area"> <div class="navbar-area">
<?php
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
) );
foreach( $categories as $category ) {
if ($category->slug == "blog") {
echo '<a class="btn btn-navbar" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
}
}?>
<!-- <a href="/blog.html" class="btn btn-navbar">Blog</a> --> <!-- <a href="/blog.html" class="btn btn-navbar">Blog</a> -->
<!-- <a href="/crea.html" class="btn btn-navbar">Romans</a> --> <!-- <a href="/crea.html" class="btn btn-navbar">Romans</a> -->
<!-- <a href="/apropos.html" class="btn btn-navbar">A propos</a> --> <!-- <a href="/apropos.html" class="btn btn-navbar">A propos</a> -->

View file

@ -8,7 +8,9 @@
) ); ) );
foreach( $categories as $category ) { foreach( $categories as $category ) {
if ($category->slug != "blog") {
echo '<a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '<span class="menu-label label-secondary">'. $category->count . '</span></a>'; echo '<a class="menu-element" href="' . get_category_link($category->term_id) . '">' . $category->name . '<span class="menu-label label-secondary">'. $category->count . '</span></a>';
}
}?> }?>
</div> </div>
</div> </div>