thachpham92

Listing post by custom taxonomy

Aug 28th, 2013
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2. $args = array(
  3. ‘post__not_in’ => $ids,
  4. ‘category_name’ => ‘tin-khuyen-mai’,
  5. ‘taxonomy’ => ‘allstates’,
  6. ‘posts_per_page’=> '5'
  7. );
  8. query_posts($args);
  9. if (have_posts()) :
  10. echo
  11. ‘<div id=”mydiv”>
  12. <ul id=”mylist”>’;
  13. $count = 0;
  14. while (have_posts()) : the_post();
  15. $count++;
  16. echo’<li id=mylist-’.$count.’>’;
  17. $ids[] = get_the_ID();
  18. ?>
  19. <span>
  20. <h2><?php the_title();?></h2>
  21. <p><?php the_excerpt(); ?></p>
  22. </span>
  23. <?php
  24. echo’</li>’;
  25. endwhile;
  26. echo ‘</ul><!– //mylist –></div><!– //mydiv –>’;
  27. endif;
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment