Home Forums WoodMart support forum Short Description help needed

Short Description help needed

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #321596

    www.cidev.ro
    Participant

    Hi there,

    We have this website:

    https://termoseminee.ro/

    If you go on the Shop page here:

    https://termoseminee.ro/shop/

    You will see that the Short Description appears underneath the image and the title of the product.

    This was achieved by inserting the following .php code in functions.php of the child theme:

    
    function webroom_add_short_description_in_product_categories() {
    	global $product;
    	if ( ! $product->get_short_description() ) return;
    	?>
    	<div itemprop="description">
    		<?php echo apply_filters( 'woocommerce_short_description', $product->get_short_description() ) ?>
    	</div>
    	<?php
    }
    add_action('woocommerce_after_shop_loop_item', 'webroom_add_short_description_in_product_categories', 5);
    
    add_filter('woocommerce_short_description','limit_short_descr');
    
    function limit_short_descr($description){
      return ($description > 140) ? substr($description, 0 , 140) : $description;
    }

    We understand that you may not provide assistance here but we are facing the following issue:

    On Desktops and laptops, the Short Description seems limited, which is great.

    If you check the same Shop Page on a mobile, it shows the whole Short Description, which makes it look very long and annoying.

    We have tested the same .php code on a different theme, Ocean WP, and it works fine, it limits the Short Description excerpt to 140 characters only.

    Please let us know if there is something from the Woodmart Theme that fetches all the Short Description on the mobile, making it look long and weird?

    Thank you!

    #321877

    Luke Nielsen
    Keymaster

    Hello,

    I checked your code in my default theme, and it doesn’t work correctly because the description was shown, but your code doesn’t limit the text on the desktop and mobile devices.

    https://gyazo.com/0f9a13d2f909248515d698f17d7804a2

    On the desktop, your short description is limited because you have such hover styles.

    It seems like there’s a problem in your code, try to change it.

    Kind Regards

    #322021

    www.cidev.ro
    Participant

    Hi there,

    Thanks for pointing us in the right direction!

    We’ll check the code and see if we can change it to something else.

    Kind regards,

    #322067

    Luke Nielsen
    Keymaster

    Hello,

    You are Welcome!

    Let us know if there’s anything else we can do for you! You can always reach us at any time.

    Kind Regards

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