Created
April 21, 2017 00:51
-
-
Save alandbh/b0d10e45a6e64c275ad9ab27e1dcf38c to your computer and use it in GitHub Desktop.
This functions gets the terms of a taxonomy inside the loop and concatenates in a variable. // Pega os termos de uma texonomia dentro do loop e concatena em uma variável.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = get_the_ID(); | |
$tipos = wp_get_post_terms( $id, 'tipo', '' ); | |
//print_r($tipos); | |
$tipoSlug = ''; | |
foreach ($tipos as $tipo) { | |
$tipoSlug .= $tipo->slug . ' '; //concatenate the terms with space between | |
} | |
?> | |
<div class="portfolio-item <?php echo $tipoSlug; ?> col-xs-12 col-sm-4 col-md-3"> | |
<a href="<?php the_permalink() ?>"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment