title: How to list categories by shortcode in wordpress?
body: <p>Could not find answer on this question, even this could be easy.
  I want to display inline categories of current post by shortcode and divided by comma.
  I tried it like this below.</p>
  
  <pre><code>function genre( $atts, $content = null ) {
  $categories = the_category(', ');
      return '&lt;div id="genre"&gt;&lt;b&gt;Genre: &lt;/b&gt;' . $categories . '&lt;/div&gt;';
  }
  
  add_shortcode("genre", "genre");
  </code></pre>
  
  <p>This returns <code>Genre:</code> </p>
  
  <pre><code>function genre( $atts, $content = null ) {
  $categories = get_the_category(', ');
      return '&lt;div id="genre"&gt;&lt;b&gt;Genre: &lt;/b&gt;' . $categories . '&lt;/div&gt;';
  }
  
  add_shortcode("genre", "genre");
  </code></pre>
  
  <p>This returns <code>Genre: Array</code></p>