Home Forums WoodMart support forum Changes on WooCommerce Category Pages after updating

Changes on WooCommerce Category Pages after updating

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #363606

    Thora
    Participant

    Hello,

    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 }
    • This topic was modified 3 years, 4 months ago by Thora.
    • This topic was modified 3 years, 4 months ago by Thora.
    • This topic was modified 3 years, 4 months ago by Thora.
    #363630

    Artem Temos
    Keymaster

    Hello,

    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

    #363636

    Thora
    Participant

    Hello.

    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.

    #363723

    Artem Temos
    Keymaster

    1. 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.

    #364081

    Thora
    Participant

    1. 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.

    #364134

    Artem Temos
    Keymaster

    1. 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.

    #364929

    Thora
    Participant

    Hello,

    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.

    #365080

    Artem Temos
    Keymaster

    As we can see, the HTML block is displayed correctly but it is just empty https://gyazo.com/06d7ce54743a6d00db0a579ed94da154
    https://gyazo.com/5904a84922e980f0a5e608009edb2491

    And 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');
    #365630

    Thora
    Participant

    Oh, 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.

    #365635

    Artem Temos
    Keymaster

    Great, we are glad that you sorted it out. Feel free to contact us if you have any further questions.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Changes on WooCommerce Category Pages after updating’ is closed to new replies.