<?php
/**
 * Custom Header Funtions
 *
 * @package Matrimony
 */
function matrimony_header_hook_callback(){
?>
<div class="hgroup-wrap">
    <div class="container">
        <section class="site-branding">
            <!-- site branding starting from here -->
			<?php 
        	$site_identity = get_theme_mod( 'site_identity_options', 'title-text' );
        	$title = get_bloginfo( 'name', 'display' );
        	$description    = get_bloginfo( 'description', 'display' );	

        	if ( 'logo-only' == $site_identity ) { 
        		if ( has_custom_logo() ){
        		the_custom_logo();
        		}
        	} elseif ( 'logo-text' == $site_identity ) {
        		if ( has_custom_logo() ) {
        			the_custom_logo();
        		}
        		if ( $description ) {
        			echo '<p class="site-description">'.esc_html( $description ).'</p>';
        		}
        	} elseif ( 'title-only' == $site_identity && $title ) {

        		if ( is_front_page() && is_home() ) { ?>
                    <h1 class="site-title">
        		    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
                     </h1>   
        		<?php } else { ?>
                    <P>
        		    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
                    </P>    
        		<?php }
        	} elseif ( 'title-text' == $site_identity ) {
        		if ( $title ) {
        			if ( is_front_page() && is_home() ) { ?>
        			<h1 class="site-title">
        				<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
        			</h1>
        			<?php } else { ?>
        				<P>
        					<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
            			</P>
        			<?php }
        		}
        		if ( $description ) {
        		echo '<p class="site-description">'.esc_html( $description ).'</p>';	
        		}
        	}
        	?>
        </section><!-- site branding ends here -->
        <?php
        $rvsp_button = get_theme_mod( 'matrimony_rvsp_text', esc_html__('RVSP', 'matrimony') );
        $rvsp_link = get_theme_mod( 'martimony_link', esc_url( home_url( '/' ).'#focus' ) );
        ?>
        
        <div id="navbar" class="navbar">
            <nav id="site-navigation" class="navigation main-navigation">
                <?php
                wp_nav_menu( array(
                    'theme_location' => 'menu-1',
                   'container_class' => 'test',
                ) );
                ?>
            </nav><!-- main-navigation ends here --> 
            <div class="header-information"> 
            	<?php
            	$rvsp_option = get_theme_mod('matrimonial_header_settings_option',0);
            	if($rvsp_option == '1'): 
            	?>
	                <?php if( !empty( $rvsp_button ) ) { ?>
	                	<a  class="button-rvsp" href="<?php echo esc_url($rvsp_link); ?>">
	                		<span><?php echo esc_html($rvsp_button); ?></span>
	                	</a>
	                <?php } ?>
	            <?php endif;   ?>	
	                
                <?php
                $search_home_option = get_theme_mod('matrimonial_header_search_settings_option',0);
                if($search_home_option == '1'): 
                ?>
                    <!-- Header Search Functions -->	
    	             <?php do_action('matrimony_search'); ?>
                <?php endif;   ?>	
            </div>
        </div><!-- navbar ends here -->
    </div>
</div><!--hgroup-wrap-->
<?php
}
add_action('matrimony_header_hook_callback_action','matrimony_header_hook_callback'); 

if ( ! function_exists( 'matrimony_customize_banner_title' ) ) :

    /**
     * Customize banner title.
     *
     * @since 1.0.0
     *
     * @param string $title Title.
     * @return string Modified title.
     */
    function matrimony_customize_banner_title( $title ) {

        if ( is_home() ) {
            $title = esc_html__( 'Blog', 'matrimony' );
        } elseif ( is_singular() ) {
            $title = single_post_title( '', false );
        } elseif ( is_category() || is_tag() ) {
            $title = single_term_title( '', false );
        } elseif ( is_archive() ) {
            $title = strip_tags( get_the_archive_title() );
        } elseif ( is_search() ) {
            $title = sprintf( esc_html__( 'Search Results for: %s', 'matrimony' ),  get_search_query() );
        } elseif ( is_404() ) {
            $title = esc_html__( '404!', 'matrimony' );
        }

        return $title;
    }

endif;

add_filter( 'matrimony_filter_banner_title', 'matrimony_customize_banner_title' ); 
