<?php
/**
 * Page Header Title
 *
 * @package celebshine
 * @subpackage celebshine
 * @since celebshine 1.0
 */

/**
 * Page Header Title Function
 */
function celebshine_page_header_title() {

	$celebshine_options= get_option( 'celebshine_redux' );

	if ( is_archive() ) {
		?>
		<h1 class="title"><?php the_archive_title(); ?></h1>
		<?php
	} elseif ( is_search() ) {
		if ( have_posts() ) :
			?>
			<h1 class="title"><?php printf( esc_html__( 'Search Results for: %s', 'celebshine' ), '<span>' . get_search_query() . '</span>' ); ?></h1>

		<?php else : ?>
			<h1 class="title"><?php esc_html_e( 'Nothing Found', 'celebshine' ); ?></h1>

			<?php
		endif;
	} elseif ( is_404() ) {

		if ( isset( $celebshine_options['404_title'] ) ) {
			?>
			<h2 class="title">
				<?php
				$title = $celebshine_options['404_title'];
				echo esc_html( $title );
				?>
			</h2>
			<?php
		} else {
			?>
			<h2 class="title"><?php esc_html_e( 'Oops! That page can not be found.', 'celebshine' ); ?></h2>
			<?php
		}
	} elseif ( is_home() ) {
		?>
		<h1 class="title"><?php esc_html_e( 'Blog', 'celebshine' ); ?></h1>
		<?php
	} else {
		if( ! empty( get_the_title() ) ){ ?>
		<h1 class="title"><?php echo get_the_title(); ?></h1>
		<?php }
	}
}
