-
Notifications
You must be signed in to change notification settings - Fork 0
/
woocustomtab.php
52 lines (39 loc) · 1.17 KB
/
woocustomtab.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
add_filter( 'woocommerce_product_tabs', 'woo_extra_product_tab' );
function woo_extra_product_tab( $tabs ) {
// Adds the new tab
$tabs['extra_tab'] = array(
'title' => __( 'Book Resources', 'woocommerce' ),
'priority' => 60,
'callback' => 'woo_extra_product_tab_content'
);
return $tabs;
}
function woo_extra_product_tab_content() {
// The new tab content
echo '<h2>External Resources</h2>';
//Your content here
}
// For additional tabs, create different functions like
<?php
add_filter( 'woocommerce_product_tabs', 'woo_video_product_tab' );
function woo_video_product_tab( $tabs ) {
// Adds the new tab
$tabs['video_tab'] = array(
'title' => __( 'Video Overview', 'woocommerce' ),
'priority' => 60,
'callback' => 'woo_video_product_tab_content'
);
return $tabs;
}
function woo_video_product_tab_content() {
// The new tab content
echo '<h2>Video Review</h2>';
//YouTube video integration
// Here I have used ACF plugin to get video ID & showing it different tab
?>
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php the_field('video_embed_code');?>" frameborder="0" allowfullscreen></iframe>
<?php
}
?>
?>