Home › Forums › WoodMart support forum › Changes on WooCommerce Category Pages after updating
Changes on WooCommerce Category Pages after updating
- This topic has 9 replies, 2 voices, and was last updated 3 years, 4 months ago by
Artem Temos.
-
AuthorPosts
-
March 24, 2022 at 10:07 am #363606
ThoraParticipantHello,
after updating WordPress, plugins and Woodmart (from 6.2.4 to 6.3.3) there are several changes on product category pages. After manually re-uploading the old Woodmart theme (not the Woodmart Core plugin), everything looks fine again.
1. Category description on all pages
With this snippet, the description is shown on all category pages when paginated and not only on the first page.
This snippet does not work anymore.2. Shortcode in category description
HTML blocks aren’t shown anymore, not even the shortcode itself as plaintext.
3. Check, if a category description exists (fixed by myself, for your information):
I have added the following code within the archive-product.php:
global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); $image = wp_get_attachment_url( $thumbnail_id ); $banner = get_term_meta( $cat->term_id, 'catbanner', true ); if ( $image ) { ?> <div class="cat-header"> <div class="cat-image" style="background-image: url('<?php echo $image; ?>');"> <p> <span class="cat-title"> <?php echo $cat->name; ?> </span> <?php $cat_description = category_description( $category_id ); if ( $cat_description ) { ?> <a href="#cat-description">Read more</a> </p> <?php } ?> </div> <div class="cat-banner"> <?php if ( $banner ) { echo do_shortcode( $banner ); } else { echo do_shortcode('[html_block id="137448"]'); } ?> </div> </div> <?php }
After updating, this check “if ( $cat_description )” doesn’t work anymore.
I could fix this by changing the code to this:
global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); $image = wp_get_attachment_url( $thumbnail_id ); $banner = get_term_meta( $cat->term_id, 'catbanner', true ); if ( $image ) { ?> <div class="cat-header"> <div class="cat-image" style="background-image: url('<?php echo $image; ?>');"> <p> <span class="cat-title"> <?php echo $cat->name; ?> </span> <?php if ( $cat->description ) { ?> <a href="#cat-description">Read more</a> </p> <?php } ?> </div> <div class="cat-banner"> <?php if ( $banner ) { echo do_shortcode( $banner ); } else { echo do_shortcode('[html_block id="137448"]'); } ?> </div> </div> <?php }
March 24, 2022 at 10:26 am #363630
Artem TemosKeymasterHello,
As we can see, you have problems with extra code customizations made by you. Sorry, but fixing such problems is out of our theme support scope.
Kind Regards
March 24, 2022 at 10:36 am #363636
ThoraParticipantHello.
1. The code “category_description()” is a regular function from WordPress and I am very confused that this query does not work anymore with your template.
2. There is no custom code. In your documentation you are showing, that HTML blocks should work within category descriptions – that they don’t after the update.
3. As explained, I did fix it by myself, but wanted to tell it to you, because maybe there is a coherence with the other problems, escpecially the first one.
March 24, 2022 at 1:43 pm #363723
Artem TemosKeymaster1. Please, test how it works with the default WordPress theme first and let us know.
2. Switch to the parent theme without any customization and send us your admin access so we could check what is wrong.
3. This code is not related to our theme at all. You or your developer added it to this file so it is not our theme bug.
March 25, 2022 at 3:08 pm #364081
ThoraParticipant1. With the theme “Twenty Twenty-One” the snippet works fine (activated via Code Snippets plugin, as it was for Woodmart child theme).
2. I switched to Woodmart parent theme, the login details I have added below.
March 25, 2022 at 7:21 pm #364134
Artem TemosKeymaster1. Could you please add the code to the default theme so we could switch and see how it works?
2. Please, send us your FTP access so we can check this.
March 29, 2022 at 1:29 pm #364929
ThoraParticipantHello,
the code is added via Code Snippets plugin. Therefor you can switch the theme, as long as the plugin and snippet is activated.
Maybe you wait with changes, until this thread is solved, where you can now find the FTP credentials.
March 30, 2022 at 6:11 am #365080
Artem TemosKeymasterAs we can see, the HTML block is displayed correctly but it is just empty https://gyazo.com/06d7ce54743a6d00db0a579ed94da154
https://gyazo.com/5904a84922e980f0a5e608009edb2491And try to use the following code snippet instead of the one that you used previously
function my_theme_woocommerce_taxonomy_archive_description() { if ( is_tax() && get_query_var( 'paged' ) != 0 ) { $term = get_queried_object(); $description = wc_format_content( $term->description ); if ( $description ) { echo ' ' . $description . ' '; } } } add_action( 'woocommerce_archive_description', 'my_theme_woocommerce_taxonomy_archive_description');
April 1, 2022 at 7:33 am #365630
ThoraParticipantOh, I’m embarrassed. I didn’t checked this HTML block. Everything else looked fine after the last backup import a few days before, so I thought it went well. Obviously, however, it was not in all places.
Thank you very much, this new snippet works.
April 1, 2022 at 7:39 am #365635
Artem TemosKeymasterGreat, we are glad that you sorted it out. Feel free to contact us if you have any further questions.
-
AuthorPosts
The topic ‘Changes on WooCommerce Category Pages after updating’ is closed to new replies.
- You must be logged in to create new topics. Login / Register