0

I would like to get the last entry of a channel from each month. is there any way to do it with channel entry module?

like: 2015, 01 : last entry is "hello 1"; 2015, 02 : last entry is "hello 2"; 2015, 03 : last entry is "hell 3";

it gives me a hard time :(

2 Answers 2

0

Surround the channel entries tag with the archive month links tag.

{exp:channel:month_links channel="YOUR_CHANNEL" limit="12"}
    {exp:channel:entries channel="YOUR_CHANNEL" limit="1" year="{year}" month="{month_num}"}
        {entry_date format="%Y  , %m"} : last entry is "{title}";
    {/exp:channel:entries}
{/exp:channel:month_links}
2
  • I think this will work I need to test it is out.. thanks very much you lighted my vision
    – Akwad Net
    Apr 8, 2015 at 23:48
  • thanks very Much this solved my issue . you saved my day :)
    – Akwad Net
    Apr 9, 2015 at 3:40
0

Why not just use the month and year parameters?

{exp:channel:entries channel="YOURCHANNELNAME" year="2015" month="01" status="not closed" limit="1" sort="asc" orderby="date" disable="categories|pagination|category_fields|member_data"}
...
{/exp:channel:entries}

If you're on an archive page like:

http:///www.your-domain-name.com/blog/archive/2015/01

You could do this:

{exp:channel:entries channel="blog" year="{segment_3}" month="{segment_4}" status="not closed" limit="1" sort="asc" orderby="date" disable="categories|pagination|category_fields|member_data"}
        ...
{/exp:channel:entries}

You can read more here:

year=, month=, day=

Hope that helps!

3
  • Thanks very much that's helps but I think this will return only a single entry. I need to return Multi entries ,, last one of each month.. thanks to you to share Year,Month , Day parameters
    – Akwad Net
    Apr 8, 2015 at 23:46
  • Then change the limit parameter. Apr 8, 2015 at 23:47
  • He's trying to output one entry from each month on one page, without embeds or php he can't use segments. Increasing the limit will only output more entries from each month. Apr 9, 2015 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.