Skip to content

Category badge customization #240

Answered by crftwrk
phrizm asked this question in Q&A
Sep 6, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi,

thank you! The category badge is a pluggable function in https://github.com/bootscore/bootscore/blob/main/inc/template-tags.php. You can simply override this in your child's functions.php. Note that text-bg-{color} classes are new in Bootstrap 5.2.0. If you are using an earlier version, you must use bg-{color} instead.

function bootscore_category_badge() {
  if ('post' === get_post_type()) {
    echo '<div class="category-badge mb-2">';
    $thelist = '';
    $i = 0;
    foreach (get_the_category() as $category) {
      if (0 < $i) $thelist .= ' ';
      $thelist .= '<a href="' . esc_url(get_category_link($category->term_id)) . '" class="badge text-bg-secondary text-decoration-none">' . 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@phrizm
Comment options

@crftwrk
Comment options

Answer selected by crftwrk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #239 on September 06, 2022 08:33.