<?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>
        </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' ); ?>
            <div class="navigation-top default-navigation">
           		<?php if( wpctp_get_option( 'track_button' ) ) : ?>
                	<a class="button" href="<?php echo home_url(); ?>/track/">Track</a><br />
				<?php endif; ?>
				<?php if( wpctp_get_option( 'header_address' ) ) : ?>
            		<i><?php echo wpctp_get_option( 'header_address' );?></i>
             	<?php endif; ?>                    
            </div>   
      		<?php do_action( 'after_navigation' ); ?>
        </div>	
	</div>
</div></div>
<div class="below-nav-header">
	<div class="wrap">    
    	<?php if ( has_nav_menu( 'primary' ) ) : ?>
    	<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 -->
        <?php 
            endif;
            ?>
    </div>
</div>