neilgee
5/8/2015 - 6:05 AM

WordPress Output Categories & Tags & Custom Taxonomy

WordPress Output Categories & Tags & Custom Taxonomy

<?php
//Output Cat
//https://codex.wordpress.org/Function_Reference/get_the_category_list
	<?php
	/* translators: used between list items, there is a space after the comma */
	$category_list = get_the_category_list( __( ', ', 'textdomain' ) );
	
	if ( themename_categorized_blog() ) {
	    echo '<div class="category-list">' . $category_list . '</div>';
	}
	?>
<?php
//Output Tag
//https://codex.wordpress.org/Function_Reference/get_the_tag_list
	<?php
	    echo get_the_tag_list( '<ul><li><i class="fa fa-tag"></i>', '</li><li><i class="fa fa-tag"></i>', '</li></ul>' );
	?>

<?php
//Output Taxonomy Terms
//https://codex.wordpress.org/Function_Reference/get_the_term_list
// get_the_term_list( $id, $taxonomy, $before, $sep, $after )
//change taxonomy name and $before
	<?php
	   echo get_the_term_list( $post ->ID, 'tax_term', 'List: ', ', ', ''); ?>