JSFiddle - React, Tailwind, and code Playground

by seefeld

HTML

$index_query = new WP_Query( array( 'post_type' => 'company', 'posts_per_page' => '-1', 'order' => 'DESC' ) );
                    while ( $index_query->have_posts() ) : $index_query->the_post();
                    
                      $taxonomy_ar = get_the_terms($post->ID, 'title');
                    
                      $output = '<span class="btn">';
                      foreach ($taxonomy_ar as $taxonomy_term) {
                        $output .= '<a href="'.get_term_link($taxonomy_term->slug, 'title').'">'. $taxonomy_term -> name .' <span class="label">'. $taxonomy_term -> count .'</span></a> ';
                      }
                      $output .= '</span>';
                    
                      echo $output;
  
  
                      endwhile;