'Page description of archive pages shows up only on the first page
My woocommerce shop page has a description set up in wordpress backend: pages > shop. Whatever I put there is shows up properly on mydomain.com/shop, but it does not show on any next page. It does not show up on mydomain.com/shop/page/2 or any other. Viewing the source code fisrt page has properly it disapears from the next pages. I don't see a reason of it, I do code the theme myself and in archive-product.php it is properly as in original included:
<?php
if ( woocommerce_product_loop() ) {
do_action( 'woocommerce_archive_description' );
I also tried couple more themes and it happens on each of them. I don't understand it really at all, spend a lot of time with this weird bug. What could be the possible reason it disapears on every next page? I did not actually see any woocommerce setting to allow description only on first page or something. Description set up on specific category has exactly the same issue. I'm developing my theme on testing site so I even reinstalled whole wordpress to deal with it and it did not help. I'm running out of ideas. Do you have one?
Solution 1:[1]
Ok found the solution. Instead the code shown above I found this one on the internet and it works on every page:
<?php
the_archive_description();
?>
Solution 2:[2]
By default, the WooComerce plugin itself would only display the description on the First Page, if you want to show it to all pages here is what you can paste the below code to the function.php file.
// Show description to all archive pages
function my_theme_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', 'my_theme_taxonomy_archive_description');
I hope this solves your problem in a proper way!
Cheers :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | user3530053 |
Solution 2 | stiviniii |