<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
if ( ! isset( $titleTag ) && empty( $titleTag ) ) {
	$titleTag = 'h3';
}

$title_text = '';
if ( ! empty( $titleLength ) ) {
	$title_text = substr( get_the_title(), 0, $titleLength );
	if ( strlen( get_the_title() ) > $titleLength ) {
		$title_text .= '...';
	}
} else {
	$title_text = get_the_title();
}
?>
<<?php echo \EcafeHelper::check_and_validate_html_tag( $titleTag ); ?> class="post-title">
	<a href="<?php echo esc_url( get_the_permalink() ); ?>"><?php echo esc_html( $title_text ); ?></a>
</<?php echo \EcafeHelper::check_and_validate_html_tag( $titleTag ); ?>>
