LatestPosts final readonly class
Minn\Blocks\Dynamic\LatestPosts · public/minn/src/Minn/Blocks/Dynamic/LatestPosts.php · 148 lines
core/latest-posts: the newest published posts as a list or a grid, each with its featured image, title, author, date and excerpt or whole content as the block asks (probe latest-posts).
Constants and properties
| private | readonly Minn\Content\Site $site | Promoted from the constructor. |
| private | readonly Minn\Front\Permalinks $permalinks | Promoted from the constructor. |
| private | readonly Minn\Content\Users $users | Promoted from the constructor. |
Public
| new | __construct(Minn\Content\Site $site, Minn\Front\Permalinks $permalinks, Minn\Content\Users $users)# | |
| method | render(Minn\Blocks\Block $block): string# | The block's HTML. The posts come from WP_Query with the reference's arguments (so pre_get_posts and the posts_* filters shape them), walked as the reference walks them: the_post for each (loop_start and loop_end around them, loop_no_results when there are none), and the main query's post set up again after, found or not. |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | featuredImage(Minn\Blocks\Block $block, Minn\Objects\Post $object, Minn\Content\PostRecord $post, string $link): string# | The post's featured image, in its own div: its size, its alignment, its width and height as limits, a link when asked; '' without one. |
| private | words(Minn\Blocks\Block $block, Minn\Objects\Post $object, Minn\Content\PostRecord $post, string $link): string# | The excerpt, or the whole content, when the block shows either. The excerpt is the post's own, through get_the_excerpt with the block's length as excerpt_length; a generated one that was cut ends in "…" and a Read more link in place of " […]". |
| private | args(Minn\Blocks\Block $block): array# | The query the block asks for: its count, published posts in its order, stickies not lifted, no total counted; its categories and author when it names them. @return array<string, mixed> |
Nothing matches.