Last active
June 11, 2018 20:18
-
-
Save Vitkalova/3c4630f156fb730191d7e7496003fb0c to your computer and use it in GitHub Desktop.
Display WooCommerce Product Category description on every page except first page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* WooCommerce displays the product category description only on the first page of the category archive | |
and the category description will not be shown on page 2, 3, etc | |
Code below helps to to display the category description on all the paginated pages | |
Add the following code to your theme’s functions.php file: */ | |
function show_taxonomy_archive_description() { | |
if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) != 0 ) { | |
$description = wc_format_content( term_description() ); | |
if ( $description ) { | |
echo '<div class="term-description">' . $description . '</div>'; | |
} | |
} | |
} | |
add_action( 'woocommerce_archive_description', 'show_taxonomy_archive_description'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment