@wilmer.lemke
To show content for each custom tab in WooCommerce, you can use the following steps:
1 2 3 4 5 6 7 8 9 |
add_filter( 'woocommerce_product_tabs', 'add_custom_tab' ); function add_custom_tab( $tabs ) { $tabs['custom_tab'] = array( 'title' => __( 'Custom Tab', 'woocommerce' ), 'priority' => 50, 'callback' => 'custom_tab_content', ); return $tabs; } |
1 2 3 4 5 |
function custom_tab_content() { // Your custom tab content goes here echo '<h2>Custom Tab Content</h2>'; echo '<p>This is the content for the custom tab.</p>'; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?php $tabs = apply_filters( 'woocommerce_product_tabs', array() ); if ( ! empty( $tabs ) ) { foreach ( $tabs as $key => $tab ) { echo '<li class="' . esc_attr( $key ) . '_tab"><a href="#tab-' . esc_attr( $key ) . '">' . apply_filters( 'woocommerce_product_' . $key . '_tab_title', $tab['title'], $key ) . '</a></li>'; } foreach ( $tabs as $key => $tab ) { echo '<div class="panel entry-content" id="tab-' . esc_attr( $key ) . '">'; call_user_func( $tab['callback'], $key, $tab ); echo '</div>'; } } ?> |
By following these steps, you can show content for each custom tab in WooCommerce. Just make sure to replace the placeholder text with your actual custom tab content.