ocastaneda82
7/22/2017 - 10:56 PM

Mostrar Términos dentro de Taxonomías dentro de un Custom Post Type

Mostrar Términos dentro de Taxonomías dentro de un Custom Post Type

<?php
$args=array(
	'public'   => true,
	'_builtin' => false
);
$output = 'names'; // or objects
$operator = 'and';
$taxonomies = get_taxonomies($args,$output,$operator);
// echo '<pre>';
// echo print_r($taxonomies);
// echo '</pre>';
if  ($taxonomies) {
	foreach ($taxonomies  as $taxonomy ) {
		$terms = get_terms([
			'taxonomy' => $taxonomy,
			'hide_empty' => false,
		]);
		echo '<pre>';
		echo print_r($terms);
		echo '</pre>';
		foreach ( $terms as $term) {
			$term_link = get_term_link( $term );
			$avatar = get_term_meta( $term->term_id, 'artisweb_term_avatar', true ); //CMB2
			?>
			<div class="col-md-4">
				<a href="<?php echo $term_link; ?>">
					<h3><?php echo $term->name; ?></h3>
					<img class="img-responsive" src="<?php echo $avatar; ?>" alt="">
					<p><?php echo $term->description; ?></p>
					<i class="fa fa-plus-circle" aria-hidden="true"></i>
				</a>
			</div class="col-md-4">
			<?php
		}
	}
}
?>