could not find answer on question, easy. want display inline categories of current post shortcode , divided comma. tried 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
function genre( $atts, $content = null ) { global $post; $categories = get_the_category_list( ', ', '', $post->id ); return '<div id="genre"><b>genre: </b>' . $categories . '</div>'; } add_shortcode("genre", "genre"); source: http://wordpress.org/support/topic/how-to-list-categories-by-shortcode
Comments
Post a Comment