0

I have a Views block display where I've collected content items from 3 different content types, filtered by a shared Taxonomy term. My sort criteria currently is "Post date (desc)" and "Type (asc)". I have the Pager displayed and a limit of 6 items to a page.

The current results are:

Page 1
First Newest item from content type 1
Second Newest item from content type 1
Third Newest item from content type 1
Fourth Newest item from content type 1
First Newest item from content type 2
Second Newest item from content type 2

Page 2
First Newest item from content type 3
Second Newest item from content type 3
Third Newest item from content type 3
Fourth Newest item from content type 3
Fifth Newest item from content type 3
Sixth Newest item from content type 3

Page 3
Etc.

The desired results are:

Page 1
First Newest item from content type 1
First Newest item from content type 2
First Newest item from content type 3
Second Newest item from content type 1
Second Newest item from content type 2
Second Newest item from content type 3

Page 2
Third Newest item from content type 1
Third Newest item from content type 2
Third Newest item from content type 3
Fourth Newest item from content type 1
Fourth Newest item from content type 2
Fourth Newest item from content type 3

Page 3
Etc.

Is this something that requires a custom module with hook_views_query_alter? If so could someone help me out with how I should build the expression in my module?

0

You just need to set a correct order in your 'sort criteria', post date first, then content type.

  • Unfortunately that doesn't work for my content if for example I have multiple content type 1 items with a post date newer than my "First Newest item from content type 2". I need the the 1st, 2nd and 3rd item in my views display to be content type 1, content type 2 and content type 3 regardless if the post dates for items from content type 2 and 3 are weeks or months older than multiple items from content type 1, which is often the case because of varying publishing schedules for the different content types. Does that make sense? – Johnny J. Hernandez Mar 3 '17 at 23:55

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.