title: How to display wordpress category name by shortcode?
body: <pre><code>    function Service_shortcode($atts , $content = null){
          extract(shortcode_atts(array(
          'title'=&gt;'',
          ),$atts
          ));
          $q = new WP_Query(
              array('posts_per_page'=&gt;3, 'post_type'=&gt;'services')
              );
  
              $list = '
                  &lt;h1&gt;'.$title.'&lt;/h1&gt;
                  &lt;ul&gt;
              ';
              while ($q-&gt;have_posts()) : $q-&gt;the_post();          
                  $list.='
                      &lt;li&gt;
                          &lt;h3&gt;'.get_the_title ().'&lt;/h3&gt;
                          &lt;h6&gt;'.the_category(',').'&lt;/h6&gt;
                          &lt;p&gt;'.get_the_content().'&lt;/p&gt;
                      &lt;/li&gt;
                  ';
              endwhile;
              $list.='&lt;/ul&gt;';
              wp_reset_query();
  
          return $list;
              }  
          add_shortcode('service','Service_shortcode');
  </code></pre>
  
  <p>when use it the_category(',') in theme it's show the category name but when use it in shortcode not working. which code use to show category name by shortcode. </p>