<?php
/**
 * Template Name: Frontpage Template
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Prevent direct access.
}

get_header();
?>

<style>
	/* Disable front_page_data when show_on_front */
	#breadcrumb-section {
		display: none;
	}
</style>

<?php
$activate_theme_data = wp_get_theme(); // getting current theme data.
$activate_theme      = $activate_theme_data->name;

$front_page = get_theme_mod( 'front_page_data', 'products,showcase,news' );
get_template_part( 'index-home/section', 'slider' );

$data = is_array( $front_page ) ? $front_page : explode( ',', $front_page );

if ( 'NewsCraft' == $activate_theme ) {	
	if ( $data ) {
		foreach ( $data as $key => $value ) {
			switch ( $value ) {

				case 'news':
					get_template_part( 'index-home/section', 'blog' );
				break;
				
				case 'products':
					get_template_part( 'index-home/section', 'woocommerce' );
				break;

				case 'showcase':
					get_template_part( 'index-home/section', 'about' );
				break;

			}
		}
	}
} else {
		if ( $data ) {
		foreach ( $data as $key => $value ) {
			switch ( $value ) {

				case 'products':
					get_template_part( 'index-home/section', 'woocommerce' );
				break;

				case 'showcase':
					get_template_part( 'index-home/section', 'about' );
				break;

				case 'news':
					get_template_part( 'index-home/section', 'blog' );
				break;
			}
		}
	}
}
 get_footer();

