Archives final readonly class
Minn\Front\Archives · public/minn/src/Minn/Front/Archives.php · 63 lines
The archive periods wp_get_archives lists: months, years, days and weeks that hold a published post of a type, newest first, each with its post count and archive URL, plus the post-by-post and alphabetical listings. Labels come from the caller's date formatter so the site's locale and week start apply; the week label joins the week's first and last day.
Constants and properties
| private | readonly Minn\Content\Posts $posts | Promoted from the constructor. |
| private | readonly Closure $date | Promoted from the constructor. |
| private | readonly Closure $dateLink | Promoted from the constructor. |
| private | readonly Closure $week | Promoted from the constructor. |
Public
| new | __construct(Minn\Content\Posts $posts, Closure $date, Closure $dateLink, Closure $week)# |
| |||||||||
| method | periods(string $granularity, string $type, string $order, int $limit, Closure $weekLink, string $where = '', string $join = ''): array# | The periods of one granularity: monthly, yearly, daily, or weekly; a WHERE and JOIN given are the query's (Posts::archiveBuckets). @return list<array{period: array{year: int, month: int, day: int, week: int}, url: string, text: string, count: int}> | |||||||||
| method | posts(string $type, string $orderBy, string $order, int $limit, Closure $title, Closure $link, string $where = '', string $join = ''): array# | The posts themselves, by date or by title.
@return list<array{url: string, text: string, count: int, id: int}> |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | weekPeriod(array $bucket, Closure $weekLink): array# |
@return array{url: string, text: string, count: int} |
Nothing matches.