Guest User

Calling Taxonomy in Wordpress

a guest
Jun 14th, 2012
223
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php $posts = get_posts('numberposts=2&offset=0&cat=19'); foreach ($posts as $post) : start_wp(); ?>
  2. <?php static $count1 = 0; if ($count1 == "2") { break; } else { ?>
  3. <div class="homeresources">
  4. <?php
  5. $terms = get_the_terms($post->ID, 'resources');
  6. echo '';
  7. foreach ($terms as $taxindex => $taxitem) {
  8. echo '<h3>' . $taxitem->name . ':</h3>';
  9. }
  10. echo ''
  11. ?>
  12. <a class="homeresourcestext" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
  13. <?php the_title(); ?>
  14. </a>
  15. <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
  16. <?php the_post_thumbnail(); ?>
  17. </a>
  18. </div>
  19. <?php $count1++; } ?>
  20. <?php endforeach; ?>
  21.  
  22.  
  23.  
  24.  
  25. <?php $posts = get_posts('numberposts=1&offset=2&cat=19'); foreach ($posts as $post) : start_wp(); ?>
  26. <?php static $count2 = 0; if ($count2 == "1") { break; } else { ?>
  27. <div class="homeresources3">
  28. <?php
  29. $terms = get_the_terms($post->ID, 'resources');
  30. echo '';
  31. foreach ($terms as $taxindex => $taxitem) {
  32. echo '<h3>' . $taxitem->name . ':</h3>';
  33. }
  34. echo ''
  35. ?>
  36. <a class="homeresourcestext" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
  37. <?php the_title(); ?>
  38. </a>
  39. </span>
  40. <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
  41. <?php the_post_thumbnail(); ?>
  42. </a>
  43. </div>
  44. <?php $count2++; } ?>
  45. <?php endforeach; ?>
RAW Paste Data