Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this questionis variable increment in $post_per_page = 10
if click on button next I can increase $Post_per_page = by_call
<button type="button" value="increment++" >Increment </button>
In Pos_per_page.php
$offset = $_GET["offset"]; // gets from primary page
the SQL call:
"Select blah from blah order by blah limit 50, $offset";
<script>
$(window).scroll(function () {
if ($(window).scrollTop() >= $(document).height() -
$(window).height() - 10) {
$.get('Pos_per_page.php?offset=10', function(data) {
// only increse
});
}
});
<?php $posts_per_page = 10;
$attachments = get_posts(array(
'post_type' => 'attachment',
'posts_per_page' => $posts_per_page,
'paged' => $paged,
/*'numberposts' => 10,*/
'category_name' => $currentSegment
));
if ($attachments) {
foreach ($attachments as $image) {
$attachmenturl_meta = wp_get_attachment_metadata($image->ID);
$attachmenturl = wp_get_attachment_url($image->ID);
$attachmentimage = wp_get_attachment_image_src($image->ID, 'full');
$attachmentvideo = wp_get_attachment_url($image->ID, 'full');
$imageDescription = apply_filters('the_description', $image->post_content);
$imageTitle = apply_filters('the_title', $image->post_title);
?>
<a data-magnify="gallery" href="<?php echo $attachmentimage[0] ?>" data-src="<?php echo $attachmentimage[0] ?>" data-caption="<?php echo $attachmentimage[0]; ?>" class="image-grid__item lightbox">
<img alt='<?php echo $imageTitle; ?>' src='<?php echo $attachmentimage[0] ?> ' class='image-grid__image' /><span class='text-center'> <?php echo $imageTitle; ?></span>
</a>