1

Im trying to use Low Yearly Archives to show a list months with a list to an individual month of articles.

I also want to show a list of years excluding the current year so the page will look something like this:

Jan Feb

2016 2015 2014

Ive had this running on EE2 but can't get it to work on EE3

Here is the code:

PHP:

<?php
$year = $this->EE->localize->format_date("%Y", $this->EE->localize->now);
?>

Tag:

{exp:low_yearly_archives channel="news" start_month="1" status="not closed" sort="desc" show_future_entries="no" start_year="<?=$year?>" end_year="<?=$year?>" dynamic="yes"}
{months}
{if num_entries > 0}
<a href="{site_url}news/archive/{year}/{month_num}/" title="{num_entries} entries in {month} {year}">{month}</a> | {num_entries}
{/if}
{/months}
{/exp:low_yearly_archives}

{exp:low_yearly_archives channel="news" status="not closed" sort="desc" end_year="<?=$year-1?>" dynamic="no"}
{if year == "<?=$year?>"}
{if:else} 
{if entries_in_year > 0}
<a href="{site_url}news/year/{year}/" title="{entries_in_year} entries in {year}"><strong>{year}</strong></a>
{/if}
{/if}
{/exp:low_yearly_archives}
  • What do you mean with "can't get it to work"? Do you get an error? Or is it not behaving the way it should? – Low Feb 24 '17 at 13:41
  • Im getting no output at all. My PHP is wrong I guess. – Kippi Feb 24 '17 at 14:43
  • Are you sure PHP is enabled on that template? – Low Feb 24 '17 at 14:45
  • I have php enabled with and parsing "input". Im not sure the php is updated for EE3. Actually Im trying to use your example code and Im not getting any results from it either even though I have 3 articles in Feb. – Kippi Feb 24 '17 at 15:31
  • Maybe EE doesn't like php in conditionals. – Low Feb 24 '17 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.