Is there a way to return different number of posts per row in grid layout based on the post size retrieved from a custom field?

For example:

|              Large post              |
|   Medium post    |    Medium post    |
| Small post | Small post | Small post |
|   Medium post    |    Medium post    |
|              Large post              |

Rows order can be different. I get the post size value from the custom fields.
I believe the logics is as follows:

  1. get the size of a post
  2. if it fits the row fully, close the row tag, open a new row tag and check the next post
  3. if the post doesnt fit the entire row, get the next post size and check if it fits

etc.

Any practical ideas?

Thanks a lot.

Read more here: Different number of posts per row in grid layout


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: