I need to order blog posts by year and month so the output would be someting like...

June 2013
Blog Title 1
Blog Title 2

May 2013
Blog Title 3
Blog Title 4

December 2012
Blog Title 5

How can I achieve this. Any help most appreciated. Thanks


You should use a date_heading.

{exp:channel:entries [...]}
    {date_heading display="monthly"}{entry_date format="%F %Y"}{/date_heading}

The value of the parameter "display" will set when the code on {date_heading} variable pair will be repeated.

Please, forgive the simple code sample, but you don't gave more details.

  • I will try that now. Thanks. I don't have enough rep to to Vote Up.
    – cfb
    Jun 10 '13 at 19:17
  • If you need more info, please improve your answer with a sample code.
    – Sobral
    Jun 10 '13 at 19:36
  • As Robson said.. date_heading AND date_footer is the solution.. Then you can group by days, week, months, year..
    – Benoit L
    Jul 7 '17 at 16:10

Using Low Yearly Archives, you can do something like that:

{exp:low_yearly_archives channel="blog" status="not closed" sort="desc" monthsort="desc"}
        {if num_entries != 0}
        <h2>{month} {year}</h2>
        {embed="news/archives_month" y="{year}" m="{month_num_short}"}

And in your archives_month embed, something along those lines (we embed to get the parsing order for {month_num_short} right):

<li><a href="{url_title_path=blog}">{title}</a></li>

You might use "Low Yearly Archives" plugin. Find the doc from here http://gotolow.com/addons/low-yearly-archives

  • Thanks. I tried Low Yearly Archives and was able to output by year and month but not pull out the actual blog posts. Not sure how to do that.
    – cfb
    Jun 10 '13 at 19:19
  • Well, use Low Yearly Archive plugin to populate the years and month in descending order. Within it just put the channel entry tag with parameter year and month like year="{year}" and month="{month}". Jun 11 '13 at 4:35
  • month="{month}" results in all entries for the channel being displayed. What am I missing? If i hardcode e.g. month="2" it works, but how can I make it dynamic? Feb 14 '14 at 20:16

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.