<?php
/**
 * Template part for displaying post author
 *
 * @package errigal
 * @since 1.0.0
 */

defined( 'ABSPATH' ) || exit;

use Errigal\Constant\{
	Errigal_Html_Attr as Html_Attr,
	Errigal_Html_Option as Html_Option,
};
use Errigal\Customiser\Errigal_Custom_Post_Author as Post_Author;
use Errigal\Shared\Errigal_Html_Builder as Html_Builder;

if ( ! Post_Author::can_show() ) {
	return;
}

Html_Builder::create()->create_a(
	array(
		Html_Option::ATTRS => array(
			Html_Attr::CLASS_NAME => 'posted-by',
			Html_Attr::HREF       => get_author_posts_url(
				get_the_author_meta( 'ID' )
			),
		),
	)
)->render_element(
	esc_html( get_the_author() )
);
