Recent posts lists

Add options recent.count to the recent posts list functions so we can
change it using config.ini
This commit is contained in:
Danang Probo Sayekti 2015-07-12 19:23:41 +07:00
commit 558263ade1
2 changed files with 9 additions and 4 deletions

View file

@ -630,10 +630,17 @@ function keyword_count($keyword)
return count($tmp);
}
// Return recent posts lists
function recent()
{
$count = config('recent.count');
if (empty($count)) {
$count = 5;
}
$str = '<ul>';
$posts = get_posts(null, 1, 5);
$posts = get_posts(null, 1, $count);
foreach ($posts as $post) {
$str .= '<li><a href="' . $post->url . '">' . $post->title . '</a></li>';
}