Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
  4. function woo_new_product_tab( $tabs ) {
  5.   if(get_field('szerokosc') || get_field('wysokosc') || get_field('glebokosc') || get_field('dlugosc') || get_field('fieldname')) {
  6.     // Adds the new tab
  7.    
  8.     $tabs['test_tab'] = array(
  9.         'title'     => __( 'Additional information', 'woocommerce' ),
  10.         'priority'  => 50,
  11.         'callback'  => 'woo_new_product_tab_content'
  12.     );
  13.   }
  14.     return $tabs;
  15. }
  16. function woo_new_product_tab_content() {
  17.     // The new tab content
  18. ?>
  19. <table id="tab-product">
  20.     <?php if(get_field('szerokosc')): echo'<tr><td class="wymiary-left"><strong>Szerokość: </strong></td><td class="wymiary-right">' ?><?php the_field('szerokosc'); echo'</td></tr>'?><?php endif; ?>
  21.     <?php if(get_field('wysokosc')): echo'<tr><td class="wymiary-left"><strong>Wysokość: </strong></td><td class="wymiary-right">' ?><?php the_field('wysokosc'); echo'</td></tr>'?><?php endif; ?>
  22.     <?php if(get_field('glebokosc')): echo'<tr><td class="wymiary-left"><strong>Głębokość: </strong></td><td class="wymiary-right">' ?><?php the_field('glebokosc'); echo'</td></tr>'?><?php endif; ?>
  23.     <?php if(get_field('dlugosc')): echo'<tr><td class="wymiary-left"><strong>Długość: </strong></td><td class="wymiary-right">' ?><?php the_field('dlugosc'); echo'</td></tr>'?><?php endif; ?>
  24. </table>
  25. <?php
  26.   echo get_field('fieldname', $post_id);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement