Auto-Generate Post Title
Author: Kev Quirk |
Hook:
on_filter_post
For any post using the notes layout with no title set, this hook generates one from the current date and time in your site's configured timezone, prepended with a note emoji. For example:
📝 2026-05-11 11:28
Useful for notes or microblog-style setups where you don't want to manually title every notes post.
function on_filter_post(array $post): array
{
$post['layout'] = trim($post['layout'] ?? '', '"\'');
if (($post['layout'] ?? '') === 'notes' && trim($post['title'] ?? '') === '') {
$config = load_config();
$post['title'] = '📝 ' . current_site_datetime_for_storage($config);
}
return $post;
}