mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 03:56:21 +05:30
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:
parent
d6f2c67ae4
commit
558263ade1
2 changed files with 9 additions and 4 deletions
|
|
@ -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>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue