In this example:

Ajax Load More will display a gallery of media attachments related by taxonomy terms.

Using theĀ taxonomy parameter Ajax Load More will load all attachments tagged with the sunset taxonomy term.


<div class="attachment">
  <?php 
  global $post; 
  $page_id = get_queried_object_id();
  $post_thumbnail_id = get_post_thumbnail_id( $page_id );
  $image = wp_get_attachment_image_src( $post_thumbnail_id, 'thumbnail-large' );
  ?>
  <img src="<?php echo $image[0]; ?>" alt="" />
</div>
PHP

The following shortcode was used to create the Taxonomy Terms example.

[ajax_load_more post_type="attachment" post_status="inherit" taxonomy="alm-attachment" taxonomy_terms="sunset" taxonomy_operator="IN" button_label="Load More Images" button_loading_label="Loading Images..." transition="masonry" masonry_selector=".attachment" posts_per_page="4"]

Note: When querying attachments you must define post_status=”inherit” in the shortcode.

The following Repeater Template was used to create the Taxonomy Terms example.