<?php $terms = get_the_terms(get_the_ID(), 'category'); ?>

<?php if ($terms && !is_wp_error($terms) && rt_get_option('single_element_category', true)) : ?>
  <div class="wp-block-post-terms is-style-colored has-xx-small-font-size">
    <?php foreach ($terms as $term) : ?>
      <a class="<?php echo 'category-' . esc_attr($term->slug) ?>" href="<?php echo esc_url(get_tag_link($term->term_id)) ?>">
        <?php echo $term->name ?>
      </a>
    <?php endforeach; ?>
  </div>
<?php endif ?>