Ask your WordPress questions! Pay money and get answers fast! (more info)

I want a ajax load more on click for get_posts loop

  • REFUNDED


<?php
if ( $current_tax ) {
$gallery_item_query = array(
'post_type' => 'gallery',
'tax_query' => array( array(
'taxonomy' => 'gallery_name',
'field' => 'related_gallery',
'terms' => $current_tax
) ),
'posts_per_page' => 2,
);
} else {
$gallery_item_query = array(
'post_type' => 'gallery',
'posts_per_page' => 2,
);
}
$gallery_item = get_posts($gallery_item_query);
?>
<section id="gallery_show">
<?php
foreach( $gallery_item as $post ) {
setup_postdata( $post );
$thisPhoto = wp_get_attachment_image_src( get_field( 'photo_file' ), 'full');
$thisPhotoThmb = wp_get_attachment_image_src( get_field( 'photo_file' ), 'medium');
echo '<div class="gallery-grid gallery-item fadeit">';
echo '<a class="image-link" href="'. $thisPhoto[0] .'" title="'. get_the_title() .'">';
echo '<img src="'. $thisPhotoThmb[0] .'" alt="'. get_the_title() .'"></a></div>';
}
?>
</section>

Answers (0)

No answers yet.