0

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

2014 2013 2012

Ive had this running on earlier versions of EE but can't get it join on 2.9

Here is the code:

PHP:

<?php
$year = $this->EE->localize->decode_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}

Im sure it has something to due with the php part but I can't get it working.

0

I figured it out. I needed to change: decode_date to format_date

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

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.