Guest User

Categorias

a guest
Mar 20th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <div id="relacion">
  2. <?php
  3. $original_post = $post;
  4. global $post;
  5. $categories = get_the_category($post->ID);
  6. if ($categories)
  7. {
  8. $category_ids = array();
  9. foreach ($categories as $individual_category)
  10. $category_ids[] = $individual_category->term_id;
  11. $args = array(
  12. 'category__in' => $category_ids,
  13. 'post__not_in' => array(
  14. $post->ID
  15. ),
  16. 'posts_per_page' => 4,
  17. 'caller_get_posts' => 1
  18. );
  19. $my_query = new wp_query($args);
  20. if ($my_query->have_posts())
  21. {
  22. echo '<div class="trela">Peliculas relacionadas</div>';
  23. while ($my_query->have_posts())
  24. {
  25. $my_query->the_post(); ?>
  26.  
  27.  
  28.  
  29.  
  30.  
  31. <div class='tpost'>
  32. <a href="<?php the_permalink() ?>">
  33. <img width="130" height="200" src="<?php getImage('1'); ?>" alt="<?php the_title(); ?>" />
  34. </a>
  35. <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  36. </div>
  37.  
  38.  
  39.  
  40.  
  41.  
  42. <?php
  43. }
  44. echo '';
  45. }
  46. }
  47. $post = $original_post;
  48. wp_reset_query();
  49. ?>
  50. </div>
Advertisement
Add Comment
Please, Sign In to add comment