Help to customize a shortcode plugin to display WordPress categories and tags

I am trying to use this WordPress plugin to generate a shortcode for my portfolio site. This idea is, that when you visit a portfolio project you will see a list of the Tags & Categories associated with the project.

The code for the plugin is below.

The shortcode looks like this: [categories taxonomy=portfolio-category]

The problem is, all categories or tags are displayed, instead of just the ones selected for a project.

Any help would be amazing. I have a feeling it’s a simple solution, but I am very new to PHP and this is well over my head.

<?php
class ListCategories{
  static function list_categories($atts, $content = null) {
    $atts = shortcode_atts(
      array(
        'child_of'            => 0,
        'current_category'    => 0,
        'depth'               => 0,
        'echo'                => 1,
        'exclude'             => '',
        'exclude_tree'        => '',
        'feed'                => '',
        'feed_image'          => '',
        'feed_type'           => '',
        'hide_empty'          => 1,
        'hide_title_if_empty' => false,
        'hierarchical'        => 1,
        'include'             => '',
        'number'              => null,
        'order'               => 'ASC',
        'orderby'             => 'name',
        'pad_counts'          => 0,
        'show_count'          => 0,
        'show_option_all'     => '',
        'show_option_none'    => __( 'No categories' ),
        'style'               => 'list',
        'taxonomy'            => 'category',
        'title_li'            => __( 'Categories' ),
        'use_desc_for_title'  => 1,
        'walker'              => null,
      ), $atts
    );

    ob_start();
    wp_list_categories($atts);
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
  }
}

add_shortcode( 'categories', array('ListCategories', 'list_categories') );
Sponsor our Newsletter | Privacy Policy | Terms of Service