fix(ui): rapikan whitespace menu bar dan batasi list kategori sidebar
This commit is contained in:
+25
-10
@@ -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; ?>
|
||||
|
||||
Reference in New Issue
Block a user