Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/10/2011, 05:08
javierm5
 
Fecha de Ingreso: abril-2011
Mensajes: 72
Antigüedad: 13 años
Puntos: 4
Respuesta: Mostrar post_types mismo tag

He intentado hacer lo que me has explicado, pero no se donde exactamente he de ponerlo en el código. No me funciona. ¿Y el otro problema sabes como solucionarlo? Este código, pero que funcione con las noticias con más de un tag:


Código PHP:
<h3>Juegos relacionados con la noticia:</h3>

<?php
//for use in the loop, list 5 post titles related to first tag on current post
$tags wp_get_post_tags($post->ID);
if (
$tags) {
  
$first_tag $tags[0]->term_id;
  
$args=array(
    
'tag__in' => array($first_tag),
    
'post_type' => juegos,    
    
'post__not_in' => array($post->ID),
    
'showposts'=>5,
    
'caller_get_posts'=>1
   
);
  
$my_query = new WP_Query($args);
  if( 
$my_query->have_posts() ) {
    while (
$my_query->have_posts()) : $my_query->the_post(); ?>

<?php
$juego 
get_post_meta($post->ID"Carátula del juego"true);
$altura get_post_meta($post->ID"Tipo de carátula"true);
$extracto get_post_meta($post->ID"Descripción"true);
?>

<div class="juego-item"><div class="thumbd"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>"><img src="<?php echo($juego?>" align="left" class="<?php echo($altura?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>"></a></div>

    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <div class="entry-content">
        <?php echo($extracto); ?>
    </div>
</div>
<?php
    
endwhile;
  } else { echo 
"No hay juegos relacionados con esta noticia" }
}
?>