I need to group the views output by each year into rows of 4 videos without the rows filling in if the year does not have 4 items.
Here is the code I am using which creates the rows and condition for the year. As you can see in the link below items for 2020 have wrapped into the 2021 row because there is only one item for 2021.
hidden link
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="container wpv-loop js-wpv-loop">
<wpv-loop wrap="4" pad="true">
[wpv-item index=1]
<div class="pt-3"><h2>[heading condition="year" value="[wpv-post-date format="Y"]"][wpv-post-date format="Y"][/heading]</h2></div>
<div class="row ">
<div class="col-md-3 px-3 py-3">[wpv-post-body view_template="loop-item-in-vimeo-videos"]</div>
[wpv-item index=other]
<div class="col-md-3 px-3 py-3">[wpv-post-body view_template="loop-item-in-vimeo-videos"]</div>
[wpv-item index=4]
<div class="col-md-3 px-3 py-3">[wpv-post-body view_template="loop-item-in-vimeo-videos"]</div>
</div>
[wpv-item index=pad]
<div class="col-md-3 px-3 py-3">pad</div>
[wpv-item index=pad-last]
<div class="col-md-3 px-3 py-3">pad-last</div>
</wpv-loop>[wpv-pager-archive-nav-links output="bootstrap" first_last_links="true"]
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Hello,
I assume we are talking about the custom shortcode [heading] from below document:
https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/
Please try to modify the codes you mentioned above as below:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="container wpv-loop js-wpv-loop">
<div class="row ">
<wpv-loop>
[heading condition="year" value="[wpv-post-date format="Y"]"]
</div><div class="pt-3"><h2>[wpv-post-date format="Y"]</h2></div><div class="row ">
[/heading]
<div class="col-md-3 px-3 py-3">[wpv-post-body view_template="loop-item-in-vimeo-videos"]</div>
</wpv-loop>[wpv-pager-archive-nav-links output="bootstrap" first_last_links="true"]
</div>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
And test again
My issue is resolved now. Thank you!