<?php
/**
 * Header top
 *
 * @package WordPress
 * @subpackage celebshine
 * @since 1.0
 * @version 1.1
 */

if( class_exists( 'ReduxFramework' ) && function_exists( 'loadmore_postSC' ) ) {
	$celebshine_options= get_option( 'celebshine_options' );

	if( $celebshine_options['opt-top'] == 1 ){

		if( ! empty( $celebshine_options['header-top-nav-bar'] ) ){ ?>
			<div class="top-banner">
				<a href="javascript:void(0);" >
					<?php
					if( ! empty( $celebshine_options['top-banner-image']['url'] ) ){
						printf( "<img src='%s' alt='%s'>", esc_url( $celebshine_options['top-banner-image']['url'] ), esc_attr__( 'Banner','celebshine' ) );
					} ?>
				</a>
				<span class="temp-notice top-banner-content"><?php echo html_entity_decode( $celebshine_options['header-top-nav-bar'] ); ?><i class="fas fa-times"></i></span>
			</div>
			<?php
		}
		if ( ! empty( $celebshine_options['header-clear-text'] ) ) {
			?>
			<div class="header-top-clear">
				<span><i class="fa-solid fa-percent"></i><?php echo do_shortcode( $celebshine_options['header-clear-text'] ); ?></span>
			</div>
			<?php
		}

		if( !empty( $celebshine_options['head_title_field'] ) || !empty( $celebshine_options['head_text_field'] ) ){
			$count = count( $celebshine_options['head_title_field'] );
			if( $count <= 4 ){ $col = 12 / $count; }else{ $col = 4; }
			$i=0;
			if( !empty( $celebshine_options['opt-top-slider'] ) == 0 ){
				echo '<div class="row">';
					for( $i=0; $i<$count; $i++ ){
						echo '<div class="col-sm-'.$col.'">';
							echo '<div class="header-top-content">';
								echo '<div>'. $celebshine_options['head_title_field'][$i] .'</div>';
								echo do_shortcode( $celebshine_options['head_text_field'][$i] );
							echo '</div>';
						echo '</div>';
					}
				echo '</div>';
			}elseif( !empty( $celebshine_options['opt-top-slider'] ) == 1 ){
				echo '<div class="header-swiper">';
					echo '<div class="swiper head-slide" data-id="head-slide">';
						echo '<div class="swiper-wrapper">';
							for( $i=0; $i<$count; $i++ ){
								echo '<div class="swiper-slide header-top-content">';
									echo '<div class="header-top-swiper">'. $celebshine_options['head_title_field'][$i] .'</div>';
									echo do_shortcode( $celebshine_options['head_text_field'][$i] );
								echo '</div>';
							}
						echo '</div>';
					echo '</div>';
				echo '</div>';
			}

		}
	}
}
