Ver Mensaje Individual
  #3 (permalink)  
Antiguo 11/04/2020, 09:53
chaleko
 
Fecha de Ingreso: noviembre-2005
Mensajes: 117
Antigüedad: 18 años, 6 meses
Puntos: 1
Respuesta: Agregar un category name dentro de un class

Gracias master por la respuesta:

Al final hice algo mas tarzanistico pero funciono

Dejo el codigo por si alguien le sirve o lo ordena

------------------------------

<?php $loop = new wp_Query(array(
'post_type' => 'portafolio_casas',
'orderby' => 'title',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'categorias',
'field' => 'slug',
'terms' => 'casas','condominios','hoteles-resort','viviendas'
))
));
?>
<?php while ($loop->have_posts()): $loop->the_post(); ?>

<?php
$categories = get_the_terms( $post->ID, 'categorias' );
$cls = '';

if ( ! empty( $categories ) ) {
foreach ( $categories as $cat ) {
$cls .= $cat->slug . ' ';
}
}
?>

<div class="mb-3 pics animation all <?php echo $cls; ?>">
</div
-----------------------------------------------

Saludos