Home › Forums › WoodMart support forum › Short Description help needed
Short Description help needed
- This topic has 3 replies, 2 voices, and was last updated 3 years, 2 months ago by Luke Nielsen.
-
AuthorPosts
-
September 28, 2021 at 7:30 am #321596
www.cidev.roParticipantHi there,
We have this website:
If you go on the Shop page here:
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!
September 29, 2021 at 6:55 am #321877
Luke NielsenKeymasterHello,
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
September 29, 2021 at 12:51 pm #322021
www.cidev.roParticipantHi 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,
September 29, 2021 at 3:01 pm #322067
Luke NielsenKeymasterHello,
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
-
AuthorPosts
- You must be logged in to create new topics. Login / Register