Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/04/2020, 08:29
chaleko
 
Fecha de Ingreso: noviembre-2005
Mensajes: 117
Antigüedad: 18 años, 5 meses
Puntos: 1
Respuesta: Como mostrar los post de una categoria en particular

Si perdón por no poner código :(

Logre llamarlas con este código lo pego por si alguien mas le sirve:
Ahora tengo problemas con llamar la imagen pero ya estoy mostrando los titulos y link de mis post.

---codigo---
<?php
/*
Template Name: Test
*/ ?>

<div class="artist-grid">

<?php

$args = array(
'post_type' => 'portafolio_casas',
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'categorias',
'field' => 'slug',
'terms' => 'chile'
)
)
);
//$query = new WP_Query( $args ); // this line is useless in your code

// The Query
$the_query = new WP_Query( $args );

// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();

echo '<div class="artist-grid-item">';

if(has_post_thumbnail()){

echo '<a>'. get_permalink() . '</a>';

echo '<div class="artist-grid-image">' . get_the_post_thumbnail( $_post->ID, 'large' ) . '</div>';
}

echo '<p>' . the_title_attribute() . '</p>';


echo "<a href='".get_permalink()."'> foto </a>";

echo '<p>' . $foto_destacada = get_field( 'foto_destacada' ) .'</p>';

echo '</div>';

}

} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();?>

</div>
---codigo---


Pero necesito colocar la imagen de un custom post dentro de un echo pero no pude :(

---código---
<?php if ( have_rows( 'galerias' ) ) : ?>
<?php while ( have_rows( 'galerias' ) ) : the_row(); ?>
<?php $foto_01 = get_sub_field( 'foto_01' ); ?>
<?php if ( $foto_01 ) { ?>

<img class="img-fluid" src="<?php echo $foto_01['url']; ?>" alt="<?php echo $foto_01['alt']; ?>" />

<?php } ?>
<?php endwhile; ?>
<?php endif; ?>
---código---

Eso gracias por el comentario!!