0

I'm just wondering if it's possible to hide all the months that don't have a blog entry?

{exp:low_yearly_archives channel="blog" start_month="1" status="not closed" sort="desc"}
  {year}
       {months}
              <li>
              {if num_entries != 0}
              <a href="{path=index.php/corporate/blog}/{year}/{month_num}/" title="{num_entries} entries in {month} {year}">{month_short} ({num_entries})</a>
              {if:else}
              {month_short}
              {/if}
              </li>
       {/months}
{/exp:low_yearly_archives}

I only have blog entries in the month on July at the moment, but it's showing me every month from January. I may be able to work around this by using "month_start" but, if there's ever a case I miss a month with a blog entry then I wouldn't want the month showing with no archives. Also, if i remove "month_short", it takes away the names, but still leaves a space for the month.

I hope this makes sense, thanks in advanced!

3

Get rid of the if:else and you'll only display months with entries

 {if num_entries != 0}
        <a href="{path=index.php/corporate/blog}/{year}/{month_num}/" title="{num_entries} entries in {month} {year}">{month_short} ({num_entries})</a>
 {/if}
1
  • Nice! That worked. Removing the {if:else} and moving the <li> within the {if} did the trick! – Funkefied Jul 12 '13 at 18:50

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.