fix(ui): rapikan whitespace menu bar dan batasi list kategori sidebar

This commit is contained in:
Mas Budi Kusuma
2026-09-17 21:27:29 +07:00
parent 0523426f7e
commit f7ce5496dd
2 changed files with 137 additions and 66 deletions
+25 -10
View File
@@ -89,16 +89,31 @@ defined( 'ABSPATH' ) || exit;
<h3 class="sidebar-widget-title"><?php echo esc_html( get_option( 'edukarsa_sidebar_cats_title', 'Kategori Pilihan' ) ); ?></h3>
<ul class="sidebar-category-list">
<?php
$categories = get_categories( array( 'hide_empty' => true ) );
foreach ( $categories as $category ) :
?>
<li>
<a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>" class="sidebar-cat-link">
<span><?php echo esc_html( $category->name ); ?></span>
<span class="sidebar-cat-count"><?php echo esc_html( $category->count ); ?></span>
</a>
</li>
<?php endforeach; ?>
$cat_limit = intval( get_option( 'edukarsa_sidebar_cats_count', 10 ) );
$cat_args = array(
'hide_empty' => true,
'orderby' => 'count',
'order' => 'DESC',
);
if ( $cat_limit > 0 ) {
$cat_args['number'] = $cat_limit;
}
$categories = get_categories( $cat_args );
if ( ! empty( $categories ) ) :
foreach ( $categories as $category ) :
?>
<li>
<a href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>" class="sidebar-cat-link">
<span><?php echo esc_html( $category->name ); ?></span>
<span class="sidebar-cat-count"><?php echo esc_html( $category->count ); ?></span>
</a>
</li>
<?php
endforeach;
else :
echo '<li style="font-size:13px; color:var(--text-muted);">' . esc_html__( 'Belum ada kategori.', 'edukarsa' ) . '</li>';
endif;
?>
</ul>
</div>
<?php endif; ?>