<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Filter tabs and allow third parties to add their own.
 *
 * Each tab is an array containing title, callback and priority.
 * @see woocommerce_default_product_tabs()
 */
$tabs = $tabs_menu = apply_filters( 'woocommerce_product_tabs', array() );
unset($tabs_menu['reviews']);

if ( ! empty( $tabs ) ) : ?>
	<div class="product-tab-section">
		<?php if (count($tabs_menu) > 1) : ?>
			<div class="ui secondary large menu product-tab">
				<?php foreach ( $tabs as $key => $tab ) :
					if ($key != 'reviews') : ?>
					<a class="<?php echo esc_attr($key == 'description' ? 'active ' : '') ?>item" data-tab="<?php echo esc_attr($key) ?>" data-key=""><?php echo apply_filters( 'woocommerce_product_' . $key . '_tab_title', esc_html( $tab['title'] ), $key ); ?></a>
				<?php endif;
				endforeach; ?>
			</div>
		<?php endif; ?>
		<?php foreach ( $tabs as $key => $tab ) :
			if ($key != 'reviews') : ?>
			<div class="ui <?php echo esc_attr($key == 'description' ? 'active ' : '') ?>tab secondary padded segment" data-tab="<?php echo esc_attr($key) ?>">
				<div class="ui large header">
					<?php echo apply_filters( 'woocommerce_product_' . $key . '_tab_title', esc_html( $tab['title'] ), $key ); ?>
				</div>
				<?php call_user_func( $tab['callback'], $key, $tab ); ?>
			</div>
		<?php elseif ($key == 'reviews') : ?>
			<div class="ui secondary padded segment">
				<?php call_user_func( $tab['callback'], 'reviews', $tab ); ?>
			</div>
		<?php endif;
		endforeach; ?>
	</div>
<?php endif; ?>
