CannaBizWeek – Add Categories to WP Dispensary Shortcodes

function cannabiz_wpd_shortcode_categories() {
  if ( in_array( get_post_type(), array( 'flowers', 'prerolls' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'flowers_category', '', ', ' ); ?></div>
  <?php }
  if ( in_array( get_post_type(), array( 'concentrates' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'concentrates_category', '', ', ' ); ?></div>
  <?php }
  if ( in_array( get_post_type(), array( 'edibles' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'edibles_category', '', ', ' ); ?></div>
  <?php }
  if ( in_array( get_post_type(), array( 'topicals' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'topicals_category', '', ', ' ); ?></div>
  <?php }
  if ( in_array( get_post_type(), array( 'growers' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'growers_category', '', ', ' ); ?></div>
  <?php }
  if ( in_array( get_post_type(), array( 'tinctures' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'wpd_tinctures_category', '', ', ' ); ?></div>
  <?php }
  if ( in_array( get_post_type(), array( 'gear' ) ) ) { ?>
    <div class="cannabiz-categories"><?php echo get_the_term_list( get_the_id(), 'wpd_gear_category', '', ', ' ); ?></div>
  <?php }
}
add_action( "wpd_shortcode_inside_top", "cannabiz_wpd_shortcode_categories" );