I offer an improved category navigation menu:

Changes to the navbar.php file
Here is the navbar.php file with the changes: https://vicovi.ru/navbar.zip
What was done:
li.navsub-toggle .badge {
float: right;
}
li.navsub-toggle a + ul {
padding-left: 15px;
}
<?php
if (!function_exists('mkSub')) {
function mkSub($catId) {
global $global;
unset($_GET['parentsOnly']);
$subcats = Category::getChildCategories($catId);
if (!empty($subcats)) {
echo "<ul style='margin-bottom: 0px; list-style-type: none;'>";
foreach ($subcats as $subcat) {
if (empty($subcat['total'])) {
continue;
}
echo '<li class="' . ($subcat['clean_name'] == @$_GET['catName'] ? "active" : "") . '">'
. '<a href="' . $global['webSiteRootURL'] . 'cat/' . $subcat['clean_name'] . '" >'
. '<span class="' . (empty($subcat['iconClass']) ? "fa fa-folder" : $subcat['iconClass']) . '"></span> ' . $subcat['name'] . ' <span class="badge">' . $subcat['total'] . '</span></a></li>';
mkSub($subcat['id']);
}
echo "</ul>";
}
}
}
if (empty($advancedCustom->doNotDisplayCategoryLeftMenu)) {
$post = $_POST;
$get = $_GET;
unset($_GET);
unset($_POST);
$_GET['current'] = $_POST['current'] = 1;
$categories = Category::getAllCategories();
foreach ($categories as $value) {
if ($advancedCustom->ShowAllVideosOnCategory) {
$total = $value['fullTotal'];
} else {
$total = $value['total'];
}
if (empty($total)) {
continue;
}
echo '<li class="' . ($value['clean_name'] == @$_GET['catName'] ? "active" : "") . '">'
. '<a href="' . $global['webSiteRootURL'] . 'cat/' . $value['clean_name'] . '" >';
echo '<span class="' . (empty($value['iconClass']) ? "fa fa-folder" : $value['iconClass']) . '"></span> ' . $value['name'];
if (empty($advancedCustom->hideCategoryVideosCount)) {
echo ' <span class="badge">' . $total . '</span>';
}
mkSub($value['id']);
echo '</a></li>';
}
$_POST = $post;
$_GET = $get;
}
?>
Replaced by:
<?php
$parsed_cats = array();
if (!function_exists('mkSub')) {
function mkSub($catId) {
global $global, $parsed_cats;
unset($_GET['parentsOnly']);
$subcats = Category::getChildCategories($catId);
if (!empty($subcats)) {
echo "<ul class=\"nav\" style='margin-bottom: 0px; list-style-type: none;'>";
foreach ($subcats as $subcat) {
if ($subcat['parentId'] != $catId) {
continue;
}
if (empty($subcat['total'])) {
continue;
}
if (in_array($subcat['id'], $parsed_cats)) {
continue;
}
//$parsed_cats[] = $subcat['id'];
echo '<li class="navsub-toggle ' . ($subcat['clean_name'] == @$_GET['catName'] ? "active" : "") . '">'
. '<a href="' . $global['webSiteRootURL'] . 'cat/' . $subcat['clean_name'] . '" >'
. '<span class="' . (empty($subcat['iconClass']) ? "fa fa-folder" : $subcat['iconClass']) . '"></span> ' . $subcat['name'] . ' <span class="badge">' . $subcat['total'] . '</span>';
echo '</a>';
mkSub($subcat['id']);
echo '</li>';
}
echo "</ul>";
}
}
}
if (empty($advancedCustom->doNotDisplayCategoryLeftMenu)) {
$post = $_POST;
$get = $_GET;
unset($_GET);
unset($_POST);
$_GET['current'] = $_POST['current'] = 1;
$categories = Category::getAllCategories();
foreach ($categories as $value) {
if ($value['parentId']) {
continue;
}
if ($advancedCustom->ShowAllVideosOnCategory) {
$total = $value['fullTotal'];
} else {
$total = $value['total'];
}
if (empty($total)) {
continue;
}
if (in_array($value['id'], $parsed_cats)) {
continue;
}
//$parsed_cats[] = $value['id'];
echo '<li class="navsub-toggle ' . ($value['clean_name'] == @$_GET['catName'] ? "active" : "") . '">'
. '<a href="' . $global['webSiteRootURL'] . 'cat/' . $value['clean_name'] . '" >';
echo '<span class="' . (empty($value['iconClass']) ? "fa fa-folder" : $value['iconClass']) . '"></span> ' . $value['name'];
if (empty($advancedCustom->hideCategoryVideosCount)) {
echo ' <span class="badge">' . $total . '</span>';
}
echo '</a>';
mkSub($value['id']);
echo '</li>';
}
$_POST = $post;
$_GET = $get;
}
?>
<script>
$(document).ready(function() {
setTimeout(function() {
$('.nav li.navsub-toggle a:not(.selected) + ul').hide();
var navsub_toggle_selected = $('.nav li.navsub-toggle a.selected');
navsub_toggle_selected.next().show();
navsub_toggle_selected = navsub_toggle_selected.parent();
var navsub_toggle_selected_stop = 24;
while(navsub_toggle_selected.length) {
if($.inArray(navsub_toggle_selected.prop('localName'), ['li', 'ul']) == -1) break;
if(navsub_toggle_selected.prop('localName') == 'ul') {
navsub_toggle_selected.show().prev().addClass('selected');
}
navsub_toggle_selected = navsub_toggle_selected.parent();
navsub_toggle_selected_stop--;
if(navsub_toggle_selected_stop < 0) break;
}
}, 500);
$('.nav').on('click', 'li.navsub-toggle a:not(.selected)', function(e) {
var a = $(this),
b = a.next();
if(b.length) {
e.preventDefault();
a.addClass('selected');
b.slideDown();
var c = a.closest('.nav').find('li.navsub-toggle a.selected').not(a).removeClass('selected').next();
if(c.length) c.slideUp();
}
});
});
</script>
Congratulations, I really like that.
can you please send a pull request?
So your name will appear as a contributor.
@DanielnetoDotCom How can I do it?
I found a link to GitHub help Maybe this will help GitHub Help link
I tried to do it
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Congratulations, I really like that.
can you please send a pull request?
So your name will appear as a contributor.