<?php
    if( !tempo_has_header() )
        return;

    $type = 'no-type';

    if( tempo_is_blog() ){
        $type = 'blog';
    }

    else if( is_category() ){
        $type = 'category';
    }

    else if( is_tag() ){
        $type = 'tag';
    }

    else if( is_search() ){
        $type = 'search';
    }

    else if( is_author() ){
        $type = 'author';
    }

    else if( is_archive() ){
        $type = 'archive';
    }
?>
	<div class="tempo-header-partial tempo-portfolio wp-templates overflow-wrapper <?php echo esc_attr( $type ); ?>">

        <?php
            if( tempo_is_blog() ){
        		$page = get_page( absint( get_option( 'page_for_posts' ) ) );

        		if( isset( $page -> ID ) ){
                    $thumbnail 		= get_post( get_post_thumbnail_id( $page ) );
                	$image 			= has_post_thumbnail( $page ) && isset( $thumbnail -> ID ) && wp_attachment_is( 'image', $thumbnail );

                    if( $image ){
                        echo '<div id="wp-custom-header" class="wp-custom-header">';
        				echo get_the_post_thumbnail( $page, apply_filters( 'sarmys_header_thumbnail_size', 'sarmys-header' ), array(
        					'alt' => esc_attr( get_the_title( $page ) ),
        					'class' => null
        				));
        				echo '</div>';
                    }

                    else{
                        the_custom_header_markup();
                    }
        		}
        	}

            else{
                the_custom_header_markup();
            }
        ?>

		<!-- mask - a transparent foil over the header image -->
		<div class="tempo-header-mask"></div>

        <!-- header content -->
		<div class="tempo-header-content">

    		<!-- main container -->
    		<div <?php echo tempo_container_class( 'main' ); ?>>
        		<div <?php echo tempo_row_class(); ?>>

					<!-- content -->
            		<div <?php echo tempo_content_class( 'sarmys-layout-full' ); ?>>
            			<div <?php echo tempo_row_class(); ?>>

				    		<?php tempo_get_template_part( "templates/header/partial/default-wp-{$type}" ); ?>

						</div>
					</div><!-- end content -->

    			</div>
    		</div><!-- end main container -->

    	</div><!-- end header content -->

	</div>
