20 stycznia, 2021

WooCommerce – opis kategorii tylko na pierwszej stronie

Dodaj to do pliku functions.php :



remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );

// Display WooCommerce product category description on only first category archive page
function codebookPL_woocommerce_taxonomy_archive_description() {

   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

   if ( is_tax( array( 'product_cat', 'product_tag' ) ) && $paged == 1 ) {

      $description = wc_format_content( term_description() );

      if ( $description ) {
         echo '<div class="term-description">' . $description .'</div>';
      }
   }
}
add_action( 'woocommerce_archive_description', 'codebookPL_woocommerce_taxonomy_archive_description');