Advertisement
Guest User

functions.php

a guest
Oct 22nd, 2018
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. if ( function_exists('icl_object_id') ) {
  2.     $lang = ICL_LANGUAGE_CODE;
  3.     echo var_dump($lang);
  4.  
  5.     function k2i_text_on_woocommerce_shop_page_desktop() {
  6.  
  7.         $text_en = '<div class="term-description-desktop">
  8.                         <div class="category-text-container">
  9.                             <div class="category-text-left-column">
  10.                                 <h1>This is where the description will be printed. </h1>
  11.                                 <p>This will be an English description</p>
  12.                             </div>
  13.                             <div class="category-text-right-column">
  14.                                 <img src="http://dssprod.be/inesbouwen/wp-content/uploads/cat-image-necklace.jpg" alt="Necklaces page banner" />
  15.                             </div>
  16.                         </div>
  17.                     </div>';
  18.  
  19.         $text_nl = '<div class="term-description-desktop">
  20.                         <div class="category-text-container">
  21.                             <div class="category-text-left-column">
  22.                                 <h1>Hier komt de beschrijving</h1>
  23.                                 <p>Hier komt een nederlandse beschrijving</p>
  24.                             </div>
  25.                             <div class="category-text-right-column">
  26.                                 <img src="http://dssprod.be/inesbouwen/wp-content/uploads/cat-image-necklace.jpg" alt="Necklaces page banner" />
  27.                             </div>
  28.                         </div>
  29.                     </div>';
  30.  
  31.         if (is_shop()) {
  32.             if ($lang == "en") {
  33.                 echo $text_en;
  34.             } else {
  35.                 echo $text_nl;
  36.             }          
  37.         }
  38.     }
  39.  
  40.     function k2i_text_on_woocommerce_shop_page_mobile() {
  41.         if (is_shop()) {
  42.             if ($lang == 'en') {
  43.                 echo '<div class="term-description-mobile">This will be the description</div>';
  44.             } else {
  45.                 echo '<div class="term-description-mobile">Hier komt de description</div>';
  46.             }
  47.         }
  48.     }
  49.  
  50.     add_action( 'woocommerce_before_shop_loop', 'k2i_text_on_woocommerce_shop_page_desktop');
  51.     add_action( 'woocommerce_after_shop_loop', 'k2i_text_on_woocommerce_shop_page_mobile');
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement