/** * 获取目标post * @param [type] $year * @param [type] $month * @param [type] $name */ function find_post($year, $month, $name) { foreach (get_post_names() as $key => $value) { if (strpos($value, "{$year}-{$month}") !== false && strpos($value, $name . '.md') !== false) { $arr = get_posts($key + 1, 1); return $arr[0]; } } return false; }
function has_pagination($page = 1) { $total = count(get_post_names()); return array('prev' => $page > 1, 'next' => $total > $page * config('posts.perpage')); }