We have the below code in a template to display archives. We have entries for January and February of this year. When we click on January, this template displays “February” as the header (even though segment_5 is 01) and it includes entries from February and January.
Everything in the code appears OK to me…
{if segment_4}
{exp:channel:entries channel="{segment_3}" year="{segment_4}" month="{segment_5}" disable="member_data|trackbacks" limit="50" paginate="both"}
{if no_results}
<h1>There were no results!</h1>
{/if}
{if count == 1}
<div class="header">
<h1><a href="http://{path=site/archive/{channel_short_name}}">{channel}</a>
<span>Archive</span></h1>
</div>
{/if}
{date_heading display="monthly"}
<ul class="date_list">
<li><h1>{entry_date format="%F %Y"}</h1></li>
{/date_heading}
{if segment_3 == "iq_moments" OR segment_3 == "training_points"}
<li class="detail">
<h2><a href="http://{page_url}class=green">{title}</a> <span class="date">{entry_date format="%M %n"}</span></h2>
<p> {cf_iq_body}<br />
</li> <br />
{if:else}<br />
<li></p><h2><a href="http://{page_url}">{title}</a></h2><p></li><br />
{/if}</p>
<p> {date_footer display="monthly"}<br />
</ul><br />
{/date_footer}</p>
<p> {paginate}<br />
<div class="pagination"><br />
Page {current_page} of {total_pages} pages {pagination_links}<br />
</div><br />
{/paginate}<br />
<br />
{/exp:channel:entries}<br />
{/if}