<ul class="sidebar__categories list-unstyled">
    <?php
    if (!empty($taxonomy)) {
        $terms = get_terms(array(
            'taxonomy' => $taxonomy,
            'hide_empty' => false,
        ));
        $i = 1;
        if (!empty($terms) && !is_wp_error($terms)) :
            foreach ($terms as $term) { ?>
                <li class="sidebar__categories__item"><a href="<?php echo esc_url(get_term_link($term->slug,$taxonomy)); ?>"><i class="icon-arrow-left"></i><?php echo esc_html($term->name); ?></a></li>
    <?php if ($i ==  $category_count) {
                    break;
                }
                $i++;
            }
        endif;
    }
    $i = 1;
    ?>
</ul><!-- /.sidebar__categories list-unstyled -->