Byline

Post author and post info

Last modified: February 3, 2026

link Block name

t2/byline

link Filters

link Template

The full template returned by the render callback function can be overwritten using the t2/block/byline/template filter.

link Date/Time Output

The t2/block/byline/get_time_or_date filter allows you to customize the date output for posted and updated dates. This provides extensive control over how dates are formatted and displayed based on project requirements.

Parameters:

Usage

\add_filter('t2/block/byline/get_time_or_date', function($output, $post_id, $timestamp, $format, $field, $date, $date_format, $time_format, $time_string, $days_since_post) {
    // Customize date output based on project requirements
    if ($field === 'modified' && $days_since_post > 30) {
        return sprintf($time_string, $date->format('c'), 'Updated ' . $date->format($date_format));
    }
    return $output;
}, 10, 10);

link Author

The filter t2/block/byline/author has been added to replace the author name, for instance if using Co Authors Plus.

link Author role

The block has a custom filter t2/block/byline/author_role to override the author role value, if you want to dynamically get this value from user meta or another source.

Usage

\add_filter('t2/block/byline/author_role', function($role) {
	if (!empty($role)) {
		return $role;
	}
	return 'My Custom Role';
});

link Author avatar

By default, when avatar display is enabled it gets the default profile avatar. You can override this with the t2/block/byline/author_avatar filter.

Usage

\add_filter('t2/block/byline/author_role', function() {
	return '<img src="" alt="" />';
});

link Style properties