Mixing 2 custom post types with posts output in specific pattern

Question

I’m trying to build a structure like this (see most excellent diagram) with two different CPTs, Videos and Ads.

I want to blend the two post types in the same wp-query so they are output in a specific pattern: 3 videos, one ad, 3 videos, one ad — up to a maximum of 16 posts. I don’t know if this is even possible, or requires magic of some sort to make it work.

I have to consider that on a mobile view, there will be a single column of posts, and this same pattern must be repeated i.e. 3 videos then an ad, repeat. Therefore using two WP Queries in a 2 column layout with videos on the left (3 per row) and ads on the the right (displaying a single ad per row), is going to end up with it displaying a bunch of videos (left column first), and then a bunch of ads at the end (i.e. the right column). Not optimal. They must be mixed, somehow.

enter image description here
For what it’s worth, I’m using JetEngine listing grid to display these posts, which has quite comprehensive WP-query settings. I have not found a way yet to specify a WP Query object. In any case, I am very happy to know if this is possible to do with WP-Query, whether or not it would work with JetEngine.

0
, turpachull 12 months 2020-03-25T12:50:59-05:00 0 Answers 104 views 0

Leave an answer