Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2. $args = array(
  3. 'post_type' => 'product',
  4. 'posts_per_page' => -1,
  5. 'orderby' => 'date',
  6. 'order' => 'DESC'
  7. );
  8. $posts = new WP_Query($args);
  9. $taxonomies = array();
  10.  
  11. foreach ($posts as $post) {
  12. foreach (get_field("taxonomia_assuntos", $post->ID) as $taxonomy) {
  13. $taxonomies[] = $taxonomy;
  14. }
  15. }
  16.  
  17. $taxonomies = array_unique($taxonomies);
  18. foreach ($taxonomies as $taxonomy) {
  19. $assunto = get_term($taxonomy);
  20. echo "<li><a href='".get_site_url()."/assuntos-de-produtos?assunto=".$assunto->term_id."'>".$assunto->name."</a></li>";
  21. }
  22.  
  23. wp_reset_query();
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement