This gets me the year, but I don’t know how to use it in a loop. Here is what I tried:
[set year][today format=Y][/set]
The current year is: [get year]
List of years:
[pass item=2016-{year}]
<li>{item}</li>
[/pass]
and this:
[set year][today format=Y][/set]
The current year is: [get year]
List of years:
[pass now=date format=Y}]
[-pass year=2016~{now}]
<li>{year}</li>
[/-pass]
[/pass]
I’m hoping to see:
The current year is: 2018
-
This reply was modified 5 years, 5 months ago by iantresman.
-
This reply was modified 5 years, 5 months ago by iantresman.
Hi,
Why do you need the current year? If you need it for a loop to match with the year of publish, you can pass more years in the future. If there is no match with a year, nothing will display for that year.
[pass list=2016~2022]
[loop type=post year={ITEM}]
[if first]
<h3><span id="{ITEM}">{ITEM}</span></h3>
[/if]
<a href="[field url]">
[field image size=medium]
</a>
[/loop]
[/pass]
Peter
That’s what I like, a different approach. Thank you!
…but out of interest, is there a way to get the current year into a pass/loop?