• Hi, I want to display inline categories of current pos by shortcodes and divided by comma.
    I tried it like this below.

    function genre( $atts, $content = null ) {
    $categories = the_category(', ');
    	return '<div id="genre"><b>Genre: </b>' . $categories . '</div>';
    }
    
    add_shortcode("genre", "genre");

    This returns Genre:

    function genre( $atts, $content = null ) {
    $categories = get_the_category(', ');
    	return '<div id="genre"><b>Genre: </b>' . $categories . '</div>';
    }
    
    add_shortcode("genre", "genre");

    This returns Genre: Array

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘List categories by shortcode?’ is closed to new replies.