I have a website that uses a "load more" button. The process for this button can be found here:


I made it pretty much verbatim (structure-wise with Element API) to that article, but I want to skip the first 6 entries because they are featured elsewhere on the site. So I tried to add .offset('6') to the for loop, and that did skip the first 6 entries. But when the "load more" button is clicked it would display the second 6 entries again (duplicates) then when you click the button again it properly continues down the list of entries.

So, how can I skip the first 6 entries in this scenario without having duplicates?

1 Answer 1


If you always want to skip the first 6 entries, you can modify the Element API endpoint to add 6 to the offset number in the query criteria:

$criteria = [
    'section' => $settings['section'], 
    'limit' =>  $settings['limit'],
    'offset' =>  ($settings['limit'] * Craft::$app->request->getParam('offset')) + 6,
    'order' => $settings['orderBy'],

That should mean you're always receiving results that are offset by the required amount for your request, plus the first 6 entries that you always want to skip.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.