Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $args = array(
- 'post_type' => 'product',
- 'posts_per_page' => -1,
- 'orderby' => 'date',
- 'order' => 'DESC'
- );
- $posts = new WP_Query($args);
- $taxonomies = array();
- foreach ($posts as $post) {
- foreach (get_field("taxonomia_assuntos", $post->ID) as $taxonomy) {
- $taxonomies[] = $taxonomy;
- }
- }
- $taxonomies = array_unique($taxonomies);
- foreach ($taxonomies as $taxonomy) {
- $assunto = get_term($taxonomy);
- echo "<li><a href='".get_site_url()."/assuntos-de-produtos?assunto=".$assunto->term_id."'>".$assunto->name."</a></li>";
- }
- wp_reset_query();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement