Answers.Body: <p>Edit: First update your checkboxes field to a lightswitch field. The checkboxes field type stores its data to the DB as a serialized array, so you can't use the field for the order parameter or a custom field parameter.</p>
  
  <p>--</p>
  
  <p>To pass the same amount of entries to each of your paginated pages I would suggest the following approach.</p>
  
  <p>Build an array of entry IDs in your desired sort order. You have to query twice using the <code>ids()</code> method and merge the returned IDs.
  First query is for the featured entries, where you add your <code>featurePost</code> field parameter, second one for all your section's entries.
  Before merging take care to not include the featured entries IDs twice by using Twigs <code>without</code> filter.</p>
  
  <p>You can now query for the entry models by passing that IDs array to the <code>id</code> parameter and adding <code>fixedOrder(true)</code>.</p>
  
  <pre><code>{% set featureEntryIds = craft.entries({
      section: 'blog',
      featurePost: 1,
      limit: 1
  }).ids() %}
  
  {% set allEntryIds = craft.entries({
      section: 'blog'
  }).ids() %}
  
  {% set sortedEntryIds = featureEntryIds|merge(
      allEntryIds|without(featureEntryIds)
  ) %}
  
  {% paginate craft.entries({
      id: sortedEntryIds,
      fixedOrder: true,
      limit: 5
  }) as entriesOnPage %}
  
      {% for entry in entriesOnPage %}
          {% set articleClass = entry.id in featureEntryIds ? 'pinned' %}
          &lt;article class="{{ articleClass }}"&gt;{{ entry.title }}&lt;/article&gt;
      {% endfor %}
  
  {% endpaginate %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T06:37:28.597Z
Answers.LastActivityDate: 2015-10-07T07:11:55.633Z
Answers.LastEditDate: 2015-10-07T07:11:55.633Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>This should show all entries, paginated, with featured posts at the start, but not pinned to the top of each page.</p>
  
  <pre><code>{% paginate craft.entries({ section: 'blog', order: 'featurePost desc, postDate desc', limit: 5 }) as entriesOnPage %}
  
      {% for entry in entriesOnPage %}
          &lt;article class="flex-container-small{% if entry.featurePost %} pinned{% endif %}"&gt;
      {% endfor %}
  
      {% include "partials/blog/_blog-pagination" %}
  
  {% endpaginate %}
  </code></pre>
  
  <p>Ordering by featurePost is good, but you can perform the check a lot more simply.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-06T01:51:50.700Z
Answers.LastActivityDate: 2015-10-06T01:51:50.700Z
Answers.UserDisplayName: Rick
Body: <p>I have multiple entries in 'blog' that have the 'featurePost' checkbox field checked. I want to display ONLY the latest, but this code is displaying multiple fields.</p>
  
  <pre><code>{% paginate craft.entries({ section: 'blog', order: 'featurePost desc, postDate desc', limit: 5 }) as entriesOnPage %}
  
  {% for entry in entriesOnPage %}
      {% if craft.entries.section('blog').featurePost.limit(1) | length %}
          &lt;article class="flex-container-small {{ entry.featurePost | length ? 'pinned' }}"&gt;
      {% else %}
          &lt;article class="flex-container-small"&gt;
      {% endif %}
  {% endfor %}
  
  {% include "partials/blog/_blog-pagination" %}
  
  {% endpaginate %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-05T21:32:55.893Z
Comments.Text: Is this inside a loop? Can you update with the loop code too?
Comments.UserDisplayName: Rick
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-06T00:16:27.343Z
Comments.Text: Yes, I just updated to include the loop.
Comments.UserDisplayName: seth
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-06T00:54:56.383Z
Comments.Text: To clarify, you want to have a paginated entry loop where you first show the latest featured post, followed by all of the rest of the entries, ordered by Post Date (desc), right? What should happen on subsequent pages? Just show the next 5 entries? Or should each page start with the same latest Featured Post entry?
Comments.UserDisplayName: Brandon Kelly
Tags: <templating><elementcriteriamodel><pagination><checkboxes><limit>
Title: Display only one entry with checkbox checked in my pagination loop?
ThreadText: # Display only one entry with checkbox checked in my pagination loop?
  
  (Asked by: username_0 on 2015-10-05)
  
  I have multiple entries in 'blog' that have the 'featurePost' checkbox field checked. I want to display ONLY the latest, but this code is displaying multiple fields.
  
  ```
  {% paginate craft.entries({ section: 'blog', order: 'featurePost desc, postDate desc', limit: 5 }) as entriesOnPage %}
  
  {% for entry in entriesOnPage %}
      {% if craft.entries.section('blog').featurePost.limit(1) | length %}
          <article class="flex-container-small {{ entry.featurePost | length ? 'pinned' }}">
      {% else %}
          <article class="flex-container-small">
      {% endif %}
  {% endfor %}
  
  {% include "partials/blog/_blog-pagination" %}
  
  {% endpaginate %}
  
  ```
  
  **Tags:** templating, elementcriteriamodel, pagination, checkboxes, limit
  
  > **Comments:**
  > **username_1**: Is this inside a loop? Can you update with the loop code too?  
  > **username_0**: Yes, I just updated to include the loop.  
  > **username_2**: To clarify, you want to have a paginated entry loop where you first show the latest featured post, followed by all of the rest of the entries, ordered by Post Date (desc), right? What should happen on subsequent pages? Just show the next 5 entries? Or should each page start with the same latest Featured Post entry?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2015-10-06. Score: 1 | Accepted answer
  
  Edit: First update your checkboxes field to a lightswitch field. The checkboxes field type stores its data to the DB as a serialized array, so you can't use the field for the order parameter or a custom field parameter.
  
  --
  
  To pass the same amount of entries to each of your paginated pages I would suggest the following approach.
  
  Build an array of entry IDs in your desired sort order. You have to query twice using the `ids()` method and merge the returned IDs.
  First query is for the featured entries, where you add your `featurePost` field parameter, second one for all your section's entries.
  Before merging take care to not include the featured entries IDs twice by using Twigs `without` filter.
  
  You can now query for the entry models by passing that IDs array to the `id` parameter and adding `fixedOrder(true)`.
  
  ```
  {% set featureEntryIds = craft.entries({
      section: 'blog',
      featurePost: 1,
      limit: 1
  }).ids() %}
  
  {% set allEntryIds = craft.entries({
      section: 'blog'
  }).ids() %}
  
  {% set sortedEntryIds = featureEntryIds|merge(
      allEntryIds|without(featureEntryIds)
  ) %}
  
  {% paginate craft.entries({
      id: sortedEntryIds,
      fixedOrder: true,
      limit: 5
  }) as entriesOnPage %}
  
      {% for entry in entriesOnPage %}
          {% set articleClass = entry.id in featureEntryIds ? 'pinned' %}
          <article class="{{ articleClass }}">{{ entry.title }}</article>
      {% endfor %}
  
  {% endpaginate %}
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2015-10-06. Score: 1
  
  This should show all entries, paginated, with featured posts at the start, but not pinned to the top of each page.
  
  ```
  {% paginate craft.entries({ section: 'blog', order: 'featurePost desc, postDate desc', limit: 5 }) as entriesOnPage %}
  
      {% for entry in entriesOnPage %}
          <article class="flex-container-small{% if entry.featurePost %} pinned{% endif %}">
      {% endfor %}
  
      {% include "partials/blog/_blog-pagination" %}
  
  {% endpaginate %}
  
  ```
  
  Ordering by featurePost is good, but you can perform the check a lot more simply.
  
  
  ---
  
  