Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $terms_array = array(
- 'taxonomy' => 'post_tag',
- );
- $services_terms = get_terms($terms_array);
- foreach($services_terms as $service): ?>
- <h4><?php echo $service->name; ?></h4>
- <?php
- $post_args = array(
- 'post_type' => 'attachment',
- 'post_mime_type' => ['application/pdf'],
- 'numberposts' => -1,
- 'post_status' => null,
- 'post_parent' => null,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'post_tag',
- 'field' => 'slug',
- 'terms' => 'sub', // ['sub', 'ins'] does not work
- )
- )
- );
- $myposts = get_posts($post_args); ?>
- <ul>
- <?php foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
- <li>
- <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
- </li>
- <?php endforeach; // Term Post foreach ?>
- </ul>
- <?php wp_reset_postdata(); ?>
- <?php endforeach; // End Term foreach; ?>
Add Comment
Please, Sign In to add comment