Guest User

Untitled

a guest
Apr 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. function hwid_load_custom_tab( $tab_key, $tab_info ) {
  3. echo apply_filters( 'the_content', $tab_info['tabContent'] );
  4. }
  5.  
  6. function hwid_add_content_tabs( $tabs ) {
  7.  
  8. global $post;
  9.  
  10. $custom_tabs = get_field( 'tabs', $post->ID );
  11.  
  12. foreach( $custom_tabs as $index => $tab ) {
  13. $tabs['customTab-' . $index] = array(
  14. 'title' => $tab['tab_title'],
  15. 'priority' => 20 + $index,
  16. 'tabContent' => $tab['tab_content'],
  17. 'callback' => 'hwid_load_custom_tab'
  18. );
  19. }
  20.  
  21. return $tabs;
  22. }
  23.  
  24. add_filter( 'woocommerce_product_tabs', 'hwid_add_content_tabs' );
Add Comment
Please, Sign In to add comment