Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Child-Theme functions and definitions
  4.  */
  5. function register_my_menus(){
  6.     register_nav_menus
  7.     (
  8.         array('lang-menu' => 'lang-menu1')
  9.     );
  10. }
  11. if(function_exists('register_nav_menus')){
  12.     add_action('init','register_my_menus');
  13. }
  14.  
  15.  /*
  16. add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
  17.  
  18. function woo_remove_product_tabs( $tabs ) {
  19.     unset( $tabs['reviews'] );          // Удаление вкладки с отзывами
  20.     return $tabs;
  21. }*/
  22. /*
  23. add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
  24. function woo_rename_tabs( $tabs ) {
  25.  
  26.     $tabs['description']['title'] = __( 'PRODUCT' );        // Переименование вкладки с описанием товара
  27.     $tabs['additional_information']['title'] = __( 'SPECIFICATION' );   // Переименование  с описанием товара
  28.  
  29.     return $tabs;
  30. }*/
  31. ?>
  32. <?php/*
  33. add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
  34. function woo_reorder_tabs( $tabs ) {
  35.     $tabs['description']['priority'] = 10;          // Описание вторая
  36.     $tabs['additional_information']['priority'] = 15;   // Дополнительная информация третья
  37.  
  38.     return $tabs;
  39. }*/
  40.  
  41. /* add_filter( 'cmb_meta_boxes', 'bhww_core_cpt_metaboxes' ); */
  42.  
  43.     /* function bhww_core_cpt_metaboxes( $meta_boxes ) {
  44.    
  45.         //global $prefix;
  46.         $prefix = '_bhww_'; // Prefix for all fields
  47.        
  48.         // Add metaboxes to the 'Product' CPT
  49.         $meta_boxes[] = array(
  50.             'id'         => 'bhww_woo_tabs_metabox',
  51.             'title'      => 'Additional Product Information - <strong>Optional</strong>',
  52.             'pages'      => array( 'product' ), // Which post type to associate with?
  53.             'context'    => 'normal',
  54.             'priority'   => 'default',
  55.             'show_names' => true,                  
  56.             'fields'     => array(
  57.                 array(
  58.                     'name'    => __( 'Ingredients', 'cmb' ),
  59.                     'desc'    => __( 'Anything you enter here will be displayed on the Ingredients tab.', 'cmb' ),
  60.                     'id'      => $prefix . 'ingredients_wysiwyg',
  61.                     'type'    => 'wysiwyg',
  62.                     'options' => array( 'textarea_rows' => 5, ),
  63.                 ),
  64.                 array(
  65.                     'name'    => __( 'Benefits', 'cmb' ),
  66.                     'desc'    => __( 'Anything you enter here will be displayed on the Benefits tab.', 'cmb' ),
  67.                     'id'      => $prefix . 'benefits_wysiwyg',
  68.                     'type'    => 'wysiwyg',
  69.                     'options' => array( 'textarea_rows' => 5, ),
  70.                 ),
  71.             ),
  72.         );
  73.  
  74.         return $meta_boxes;
  75.        
  76.     } */
  77.  
  78.  
  79.     add_filter( 'woocommerce_product_tabs', 'bhww_woo_extra_tabs' );
  80.    
  81.     function bhww_wooprint_r($post);_extra_tabs( $tabs ) {
  82.    
  83.         global $post;
  84.         $product_ingredients = get_post_meta( $post->ID, '_bhww_ingredients_wysiwyg', true );
  85.         $product_benefits    = get_post_meta( $post->ID, '_bhww_benefits_wysiwyg', true );
  86.      
  87.         if ( ! empty( $product_ingredients ) ) {
  88.        
  89.             $tabs['ingredients_tab'] = array(
  90.                 'title'    => __( 'Ingredients', 'woocommerce' ),
  91.                 'priority' => 15,
  92.                 'callback' => 'bhww_woo_ingredients_tab_content'
  93.             );
  94.            
  95.         }
  96.        
  97.         if ( ! empty( $product_benefits ) ) {
  98.        
  99.             $tabs['benefits_tab'] = array(
  100.                 'title'    => __( 'Benefits', 'woocommerce' ),
  101.                 'priority' => 16,
  102.                 'callback' => 'bhww_woo_benefits_tab_content'
  103.             );
  104.            
  105.         }
  106.        
  107.         return $tabs;
  108.      
  109.     }
  110.    
  111.     function bhww_woo_ingreprint_r($post);dients_tab_content() {
  112.    
  113.         global $post;
  114.         $product_ingredients = get_post_meta( $post->ID, '_bhww_ingredients_wysiwyg', true );
  115.      
  116.         if ( ! empty( $product_ingredients ) ) {
  117.        
  118.             echo '<h2>' . esc_html__( 'Product Ingredients', 'woocommerce' ) . '</h2>';
  119.            
  120.             // Updated to apply the_content filter to WYSIWYG content
  121.             echo apply_filters( 'the_content', $product_ingredients );
  122.            
  123.         }
  124.      
  125.     }
  126.    
  127.     function bhww_woo_benefprint_r($post);its_tab_content() {
  128.    
  129.         global $post;
  130.         $product_benefits = get_post_meta( $post->ID, '_bhww_benefits_wysiwyg', true );
  131.      
  132.         if ( ! empty( $product_benefits ) ) {
  133.        
  134.             echo '<h2>' . esc_html__( 'Product Benefits', 'woocommerce' ) . '</h2>';
  135.        
  136.             // Updated to apply the_content filter to WYSIWYG content
  137.             echo apply_filters( 'the_content', $product_benefits );
  138.            
  139.         }
  140.      
  141.     }
  142.  
  143. if ( ! empty( $product_ingredients ) ) {
  144.  apply_filters( 'the_content', $product_ingredients );
  145. }
  146. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement