<?php
/**
 * Displays header media
 *
 * @package WordPress
 * @subpackage WPCargo_Theme_Pro
 * @since 1.0
 * @version 1.0
 */
?>
<div class="top-header relative">
    <div class="wrap">
        <div class="top-header-inner">
            <div class="left-top-header">
                <ul>
                    <?php if( wpctp_get_option( 'email' ) ) : ?>
                        <li><a href="mailto:<?php echo wpctp_get_option( 'email' );?>"><?php echo wpctp_get_option( 'email' );?></a></li>
                    <?php endif; ?>
                    <?php if( wpctp_get_option( 'phone' ) ) : ?>
                        <li><a href="tel:<?php echo wpctp_get_option( 'phone' );?>"><?php echo wpctp_get_option( 'phone' );?></a></li>
                    <?php endif; ?>
                </ul>
            </div>
            <div class="right-top-header">
                <?php 
                    if (wpctp_get_option( 'login' )) {
                        if (is_user_logged_in()) {
                            printf( '<a class="ht-link login-top" href="%s">Logout</a>', wp_logout_url() );
                        }else{
                            printf( '<a class="ht-link logout-top" href="%s/wp-admin/">Login</a>', get_bloginfo( 'url' ) );
                        }
                    }
                    if (wpctp_get_option( 'myaccount' )) {
                            printf( '<a class="ht-link account-top" href="%s/my-account/">My Account</a>', get_bloginfo( 'url' ) );
                    }		
                ?>
                
    <ul class="social links">
        <?php foreach( wpctp_social_networks() as $id => $network ) : ?>
            <?php if( wpctp_get_option( "htn_" . $id ) ) : ?>
                <?php $link = wpctp_get_option( "network_" . $id  ) ? : '#'; ?>
                <?php printf( '<a href="%s" class="fa fa-%s"></a>', $link, $id ); ?>
            <?php endif; ?>
        <?php endforeach; ?>
    </ul>
            </div>
            <?php if( has_post_thumbnail() ) : ?><div class="border"></div><?php endif; ?>
        </div>
    </div>
</div>
<div class="header-wrap"><div class="custom-header default-header layout-2 relative">
    <div class="wrap">
        <div class="table">
        	<?php do_action( 'before_branding' ); ?>
            <div class="site-branding">
				<?php if ( has_post_thumbnail() ) : ?>
                    <?php
                        printf(
                            '<a href="%s" style="line-height:0;display:inline-block;"><img id="%s" src="%s" data-main="%s" data-sticky="%s" alt="%s" /></a>',
                            trailingslashit( home_url() ),
                            'wpctp-logo',
                            esc_url( wpctp_get_option( 'transparent_logo' ) ),
                            esc_url( wpctp_get_option( 'transparent_logo' ) ),
                            esc_url( wpctp_get_option( 'sticky_logo' ) ),
                            get_bloginfo( 'name' )
                        );
                    ?>
                <?php else : ?>
                    <?php
                        printf(
                            '<a href="%s" style="line-height:0;display:inline-block;"><img id="%s" src="%s" data-main="%s" data-sticky="%s" alt="%s" /></a>',
                            trailingslashit( home_url() ),
                            'wpctp-logo',
                            esc_url( wpctp_get_option( 'logo' ) ),
                            esc_url( wpctp_get_option( 'logo' ) ),
                            esc_url( wpctp_get_option( 'sticky_logo' ) ),
                            get_bloginfo( 'name' )
                        );
                    ?>
                <?php endif; ?>                         
            </div>
        	<?php do_action( 'before_navigation' ); ?>
            <?php if ( has_nav_menu( 'primary' ) ) : ?>
                <div class="navigation-top default-navigation">
                        <nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'wpctp' ); ?>">
                        
                            <?php wp_nav_menu( array(
                                'theme_location' => 'primary',
                                'menu_id'        => 'primary-menu',
                            ) ); ?>
                            
                        </nav><!-- #site-navigation -->
                            
                </div><!-- .navigation-top -->   
                
            <?php endif; ?>
        	<?php do_action( 'before_search_icon' ); ?>
            <div class="search-icon-wrap table-cell"><a class="wpctp-search-icon fa fa-search"></a></div>
        	<?php do_action( 'after_search_icon' ); ?>
        </div>
        <div class="wpctp-search-form" style="display:none;"><?php get_search_form(); ?></div>	
	</div>
</div></div>
