Forum
Loading 'x' amount of shop items on the same page with a load more button?
I have posted a question on something similar before about how to load 'x' amount of items on the same page on click of a button. The answer that Drew provided here I have tried implementing in another instance in a shop however it isn't quite working the same way. This is my code at the moment...
<?php
$increment = 6;
$count = (int) perch_get('count', $increment);
perch_shop_products_by_category('shop', array(
'paginate' => true,
'count'=>$count,
)); ?>
I'm trying to get it so that it shows 6 items on the shop homepage initially with a load more button underneath which will load 6 more when clicked on the same page without reloading the page, this code above is currently taking my original 6 items and paginating them 1 per page across 6 pages with a next/prev button.
Any idea where I'm going wrong here? Much appreciated!
Have you included the
$count+$increment
to increment the count each time?Do you mean:
I forgot to add that into my question but that is included so all in all its:
You don't want to use pagination - that will break things.
If you need to load it without the page reloading, you'll have to do that with JavaScript.