Archive of: '.perch_blog_category(perch_get('cat'), true).'';
perch_blog_custom(array(
'category' => perch_get('cat'),
'template' => $template,
'count' => $posts_per_page,
'sort' => $sort_by,
'sort-order' => $sort_order,
));
$posts_displayed = true;
}
/* --------------------------- POSTS BY TAG --------------------------- */
if (perch_get('tag')) {
echo '
Archive of: '.perch_blog_tag(perch_get('tag'), true).'
';
perch_blog_custom(array(
'tag' => perch_get('tag'),
'template' => $template,
'count' => $posts_per_page,
'sort' => $sort_by,
'sort-order' => $sort_order,
));
$posts_displayed = true;
}
/* --------------------------- POSTS BY DATE RANGE --------------------------- */
if (perch_get('year')) {
$year = intval(perch_get('year'));
$date_from = $year.'-01-01 00:00:00';
$date_to = $year.'-12-31 23:59:59';
$title_date_format = '%Y';
// Month and Year?
if (perch_get('month')) {
$month = intval(perch_get('month'));
$date_from = $year.'-'.str_pad($month, 2, '0', STR_PAD_LEFT).'-01 00:00:00';
$date_to = $year.'-'.str_pad($month, 2, '0', STR_PAD_LEFT).'-31 23:59:59';
$title_date_format = '%B, %Y';
}
echo 'Archive of: '.strftime($title_date_format, strtotime($date_from)).'
';
perch_blog_custom(array(
'filter' => 'postDateTime',
'match' => 'eqbetween',
'value' => $date_from.','.$date_to,
'template' => $template,
'count' => $posts_per_page,
'sort' => $sort_by,
'sort-order' => $sort_order,
));
$posts_displayed = true;
}
/* --------------------------- POSTS BY AUTHOR --------------------------- */
if (perch_get('author')) {
echo 'Posts by '.perch_blog_author(perch_get('author'), array(
'template' => 'author_name.html',
), true).'
';
perch_blog_custom(array(
'author' => perch_get('author'),
'template' => $template,
'count' => $posts_per_page,
'sort' => $sort_by,
'sort-order' => $sort_order,
));
$posts_displayed = true;
}
/* --------------------------- DEFAULT: ALL POSTS --------------------------- */
if ($posts_displayed == false) {
// No other options have been used; no posts have been displayed yet.
// So display all posts.
echo 'Archive
';
perch_blog_custom(array(
'template' => $template,
'count' => $posts_per_page,
'sort' => $sort_by,
'sort-order' => $sort_order,
));
}
?>