1

I'm trying to get entries from two sections and merge them together which is pretty straight forward using the merge filter.

For example, my sections are:

  • News
  • Promoted News

But, my main issue is I only want Entry 1 from Promoted News to appear after 2 entries in News and so on (In a 2 entry increment)

I don't want it like this:

  • News - Entry 1
  • Promoted News - Entry 1
  • News - Entry 2
  • Promoted News - Entry 2
  • News - Entry 3
  • Promoted News - Entry 3
  • News - Entry 4
  • Promoted News - Entry 4
  • News - Entry 5
  • Promoted News - Entry 5

But like this:

  • News - Entry 1
  • News - Entry 2
  • Promoted News - Entry 1
  • News - Entry 3
  • News - Entry 4
  • Promoted News - Entry 2
  • News - Entry 5
  • News - Entry 6
  • Promoted News - Entry 3

I thought about doing it using a conditional and incrementing a variable, but I don't think this would work with pagination so I need to merge them in to one array.

Is it possible to do this? My heads mashed thinking about doing this...

Thanks!

  • Hi Jason, did you ever get an answer to this? I am trying do something similar but with two different entry types, Thanks. – Gareth Aug 27 '17 at 15:10
  • Sadly not :( I did consider writing a plugin to do this, but we never got round to it. – Jason Mayo Sep 1 '17 at 9:44
1

Seems like a rather specific edge case, so I'd be surprised if there's something built in (nothing comes to mind). However, you could write a custom twig filter fairly easily to do this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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