Hi Guys, I have used the below code to create an archive on blog stories. This works fine with all stories in the child directory to blog, however when I put them in the relevant folders eg 2014 > 01 > blogstory it doesn't seem to pull them through. Does anyone have any ideas, any help would be greatly appreciated.
Thanks,
Melissa <?php $channel = $pages->get("/blog/"); $startYear = date("Y"); // this year $endYear = 2009; // or whenever you want it to end $now = time(); for($year = $startYear; $year >= $endYear; $year--) { for($month = 12; $month > 0; $month--) { $startTime = strtotime("$year-$month-01"); // 2011-12-01 example if($startTime > $now) continue; // don't bother with future dates if($month == 12) $endTime = strtotime(($year+1) . "-01-01"); else $endTime = strtotime("$year-" . ($month+1) . "-01"); $entries = $channel->children("blog_date>=$startTime, blog_date<$endTime"); // or substitute your own date field $date = date("F, Y",$startTime); $url = "/blog/" . date("Y",$startTime) . "/" . date("m",$startTime); $count = count($entries); if($count > 0) echo "<a href='$url'>$date (" . $count . ")</a><br>"; // output the month and count } } ?>