Archived topic
Length of text
3 replies · Started by Max on June 2, 2022
Hi is it possible to put a maximum on the words that appear?
On mobile i want a option that you get. ''Read more'' cause right now you see only text and not the picture of the products. So i want for example that only 20 words appear and the other ones only appear if people press on read more.
Hi there,
is that for the category description ?
Yes
OK, so you will need to tell Woo you want to be able to add HTML inside the description field. This doc provides the PHP Snippet you need to add to your site for that:
https://woocommerce.com/document/allow-html-in-term-category-tag-descriptions/
Then you will need some HTML, JS and CSS to create the read more / less function.
I found an example here:
https://stackoverflow.com/a/53011670
HTML goes in the Product description field.
The Javascript you can add to a HooK Element and select the wp_footer hook, and make sure to add the code inside script tags ie,
<script>
Javscript here
</script>
And the CSS goes wherever you normally add it.