woocommerce/templates/single-product/tabs/tabs.php

57 lines
2.0 KiB
PHP
Raw Normal View History

2011-12-09 20:16:34 +00:00
<?php
/**
2015-11-03 13:53:50 +00:00
* Single Product tabs
2012-08-14 18:05:45 +00:00
*
2015-11-03 13:31:20 +00:00
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/tabs/tabs.php.
*
2016-02-12 11:28:41 +00:00
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
2019-09-26 17:18:56 +00:00
* @see https://docs.woocommerce.com/document/template-structure/
2020-08-05 16:36:24 +00:00
* @package WooCommerce\Templates
2019-09-26 17:26:09 +00:00
* @version 3.8.0
2011-12-09 20:16:34 +00:00
*/
2012-04-03 09:34:02 +00:00
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
2015-11-03 13:31:20 +00:00
* Filter tabs and allow third parties to add their own.
*
2013-02-10 18:49:22 +00:00
* Each tab is an array containing title, callback and priority.
2019-09-26 17:18:56 +00:00
*
* @see woocommerce_default_product_tabs()
*/
2019-09-26 17:18:56 +00:00
$product_tabs = apply_filters( 'woocommerce_product_tabs', array() );
2012-04-03 09:34:02 +00:00
2019-09-26 17:18:56 +00:00
if ( ! empty( $product_tabs ) ) : ?>
<div class="woocommerce-tabs wc-tabs-wrapper">
<ul class="tabs wc-tabs" role="tablist">
2019-09-26 17:18:56 +00:00
<?php foreach ( $product_tabs as $key => $product_tab ) : ?>
2016-11-04 23:56:14 +00:00
<li class="<?php echo esc_attr( $key ); ?>_tab" id="tab-title-<?php echo esc_attr( $key ); ?>" role="tab" aria-controls="tab-<?php echo esc_attr( $key ); ?>">
2019-09-26 17:18:56 +00:00
<a href="#tab-<?php echo esc_attr( $key ); ?>">
<?php echo wp_kses_post( apply_filters( 'woocommerce_product_' . $key . '_tab_title', $product_tab['title'], $key ) ); ?>
</a>
</li>
<?php endforeach; ?>
2012-04-03 09:34:02 +00:00
</ul>
2019-09-26 17:18:56 +00:00
<?php foreach ( $product_tabs as $key => $product_tab ) : ?>
2016-11-04 23:56:14 +00:00
<div class="woocommerce-Tabs-panel woocommerce-Tabs-panel--<?php echo esc_attr( $key ); ?> panel entry-content wc-tab" id="tab-<?php echo esc_attr( $key ); ?>" role="tabpanel" aria-labelledby="tab-title-<?php echo esc_attr( $key ); ?>">
2019-09-26 17:18:56 +00:00
<?php
if ( isset( $product_tab['callback'] ) ) {
call_user_func( $product_tab['callback'], $key, $product_tab );
}
?>
</div>
2019-09-26 17:18:56 +00:00
<?php endforeach; ?>
<?php do_action( 'woocommerce_product_after_tabs' ); ?>
2012-04-03 09:34:02 +00:00
</div>
<?php endif; ?>