Answers.Body: <p>I think you're correct in how you currently do it. You can't merge Element Queries, you can merge IDs (or any array of anything, really). 
  The only thing you should remove, is the <code>all</code> when settings <code>posts</code>, because <code>paginate</code> expects an element query, not an array of elements. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-09T15:08:39.037Z
Answers.Text: You are correct! I didn't test the code before posting so I'll go ahead and edit that.
Answers.UserDisplayName: Matthew Rotter
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-09T15:15:38.053Z
Answers.Text: I just wasn't sure if there was some sexy way to combine both queries into a single line instead
Answers.UserDisplayName: Matthew Rotter
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-09T15:20:48.940Z
Answers.Text: I don’t think there’s a way to combine relatedTo with a custom field condition and achieve what you want to achieve.
Answers.UserDisplayName: Paul
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-09T15:01:51.807Z
Answers.LastActivityDate: 2019-05-09T15:01:51.807Z
Answers.UserDisplayName: Paul
Answers.Body: <p>Here's how I'd do it currently: </p>
  
  <pre><code>{% set cat1 = craft.categories.group("catAttributes").slug('diabetic').one %}
  
  {% set firstEntries = craft.entries.section("cats").relatedTo([cat1]).ids() %}
  
  {% set secondEntries = craft.entries.section("cats").showInOtherOnCatsWithNeeds('1').ids() %}
  
  {% set allEntries = firstEntries | merge(secondEntries) %}
  
  {% set posts = craft.entries.id( allEntries ) %}
  
  {% paginate posts.limit(12) as pageInfo, pet %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-09T14:52:01.303Z
Answers.LastActivityDate: 2019-05-09T15:09:00.720Z
Answers.LastEditDate: 2019-05-09T15:09:00.720Z
Answers.UserDisplayName: Matthew Rotter
Body: <p>I really want something like this to work but the merge function turns Elements into Arrays. I've managed to work around it other times but what's the best practice to combine two entry sets and then paginate?</p>
  
  <pre><code>{% set cat1 = craft.categories.group("catAttributes").slug('diabetic').one %}
  
  {% set firstEntries = craft.entries.section("cats").relatedTo([cat1]) %}
  
  {% set secondEntries = craft.entries.section("cats").showInOtherOnCatsWithNeeds('1') %}
  
  {% set allEntries = firstEntries | merge(secondEntries) %}
  
  {% paginate allEntries.limit(12) as pageInfo, pet %}
  </code></pre>
  
Tags: <entries><pagination><merge>
Title: Paginating Merged Element Queries
ThreadText: # Paginating Merged Element Queries
  
  (Asked by: username_0 on 2019-05-09)
  
  I really want something like this to work but the merge function turns Elements into Arrays. I've managed to work around it other times but what's the best practice to combine two entry sets and then paginate?
  
  ```
  {% set cat1 = craft.categories.group("catAttributes").slug('diabetic').one %}
  
  {% set firstEntries = craft.entries.section("cats").relatedTo([cat1]) %}
  
  {% set secondEntries = craft.entries.section("cats").showInOtherOnCatsWithNeeds('1') %}
  
  {% set allEntries = firstEntries | merge(secondEntries) %}
  
  {% paginate allEntries.limit(12) as pageInfo, pet %}
  
  ```
  
  **Tags:** entries, pagination, merge
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-05-09. Score: 2
  
  I think you're correct in how you currently do it. You can't merge Element Queries, you can merge IDs (or any array of anything, really).
  The only thing you should remove, is the `all` when settings `posts`, because `paginate` expects an element query, not an array of elements.
  
  > **Comments:**
  > **username_0**: You are correct! I didn't test the code before posting so I'll go ahead and edit that.  
  > **username_0**: I just wasn't sure if there was some sexy way to combine both queries into a single line instead  
  > **username_1**: I don’t think there’s a way to combine relatedTo with a custom field condition and achieve what you want to achieve.  
  
  ---
  
  ### Answer by username_0 on 2019-05-09. Score: 2
  
  Here's how I'd do it currently:
  
  ```
  {% set cat1 = craft.categories.group("catAttributes").slug('diabetic').one %}
  
  {% set firstEntries = craft.entries.section("cats").relatedTo([cat1]).ids() %}
  
  {% set secondEntries = craft.entries.section("cats").showInOtherOnCatsWithNeeds('1').ids() %}
  
  {% set allEntries = firstEntries | merge(secondEntries) %}
  
  {% set posts = craft.entries.id( allEntries ) %}
  
  {% paginate posts.limit(12) as pageInfo, pet %}
  
  ```
  
  
  ---
  
  