-1

I want to create a view with news which outputs another content type after every 5th result, in my case a newsletter subscription.

How can I do this?

1
  • This isn't doable from the Views UI. You'd need to create two result sets from a query, and in the main output, insert a row every 5th result. You'd also have to account for paging, etc.
    – Kevin
    Commented Jan 19, 2019 at 17:19

1 Answer 1

0

Views paging isn't conditional, so you can't assign different filters and other settings to different sets of result items.

But you can achieve what you want by creating different Views displays, each with its own filter settings, then display them one below the other on a page, style the output so it looks like it's coming from the same source.

If you make the different displays to be Attachment types, you will be able to make them display before or after the display they're attached to, all through the Views interface. If your original display is of Page type it's the most convenient to make the other ones as Attachment types.

You could also create Blocks display types, but then you have to place each one individually in a region of your theme and order them the way you want.

Use Views Displays

Here are steps how to do it:

  1. Edit your original view display to only show 5 items of only the one Content type you want to show up first.
  2. Duplicate that display as an Attachment, then override the filter to show a different content type and set it to attach after the first display
  3. Duplicate the Attachement and repeat the edit: override the filter to show the third content type and set it to attach after the first display
  4. Repeat again if you have more content types
  5. Use CSS to style the attachments without gaps in between them so they look like they are one unit in your design

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.