<?php
/**
 * Template part for displaying entry header.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package     Business Interface
 * @author      WPInterface Team
 * @since       1.0.0
 */

/**
 * Do not allow direct script access.
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

?>

<?php do_action( 'business_interface_before_entry_header' ); ?>
<header class="entry-header">

	<?php
	$business_interface_tag = is_single( get_the_ID() ) && ! business_interface_page_header_has_title() ? 'h1' : 'h2';
	$business_interface_tag = apply_filters( 'business_interface_entry_header_tag', $business_interface_tag );

	$business_interface_title_string = '%2$s%1$s';

	if ( 'link' === get_post_format() ) {
		$business_interface_title_string = '<a href="%3$s" title="%3$s" rel="bookmark">%2$s%1$s</a>';
	} elseif ( ! is_single( get_the_ID() ) ) {
		$business_interface_title_string = '<a href="%3$s" title="%4$s" rel="bookmark">%2$s%1$s</a>';
	}

	$business_interface_title_icon = apply_filters( 'business_interface_post_title_icon', '' );
	$business_interface_title_icon = business_interface()->icons->get_svg( $business_interface_title_icon );
	?>

	<<?php echo tag_escape( $business_interface_tag ); ?> class="entry-title"<?php business_interface_schema_markup( 'headline' ); ?>>
		<?php
		echo sprintf(
			wp_kses_post( $business_interface_title_string ),
			wp_kses_post( get_the_title() ),
			$business_interface_title_icon ? wp_kses_post( $business_interface_title_icon ) : '',
			esc_url( business_interface_entry_get_permalink() ),
			the_title_attribute( array( 'echo' => false ) )
		);
		?>
	</<?php echo tag_escape( $business_interface_tag ); ?>>

</header>
<?php do_action( 'business_interface_after_entry_header' ); ?>
