Answers.Body: <p>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:</p>
  <pre><code>$criteria = [
      'section' =&gt; $settings['section'], 
      'limit' =&gt;  $settings['limit'],
      'offset' =&gt;  ($settings['limit'] * Craft::$app-&gt;request-&gt;getParam('offset')) + 6,
      'order' =&gt; $settings['orderBy'],
  ];
  </code></pre>
  <p>That should mean you're always receiving results that are offset by the required amount for your request, <em>plus</em> the first 6 entries that you always want to skip.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-08T13:17:01.793Z
Answers.Text: That worked! How would I do it if I only wanted to skip the first 6 just on the homepage and not elsewhere?
Answers.UserDisplayName: Justin Kendall
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-08T18:20:47.147Z
Answers.Text: I thought this might deserve its own question, so I opened a new question here: (https://craftcms.stackexchange.com/questions/35754/how-to-use-multiple-different-instances-element-api-load-more-button)
Answers.UserDisplayName: Justin Kendall
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-08T09:04:56.440Z
Answers.LastActivityDate: 2020-07-08T09:04:56.440Z
Answers.UserDisplayName: Martin Spain
Body: <p>I have a website that uses a &quot;load more&quot; button. The process for this button can be found here:</p>
  <p><a href="http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms" rel="nofollow noreferrer">http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms</a></p>
  <p>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 <code>.offset('6')</code> to the for loop, and that did skip the first 6 entries. But when the &quot;load more&quot; 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.</p>
  <p>So, how can I skip the first 6 entries in this scenario without having duplicates?</p>
  
Tags: <craft3><php><plugin-elementapi><javascript>
Title: How to skip the first few entries in a "load more" scenario with Element API?
ThreadText: # How to skip the first few entries in a "load more" scenario with Element API?
  
  (Asked by: username_0 on 2020-07-07)
  
  I have a website that uses a "load more" button. The process for this button can be found here:
  
  <http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms>
  
  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?
  
  **Tags:** craft3, php, plugin-elementapi, javascript
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-07-08. Score: 2 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: That worked! How would I do it if I only wanted to skip the first 6 just on the homepage and not elsewhere?  
  > **username_0**: I thought this might deserve its own question, so I opened a new question here: (https://craftcms.stackexchange.com/questions/35754/how-to-use-multiple-different-instances-element-api-load-more-button)  
  
  ---
  
  