In the product pages I need to show the content from the short description field (which is a normal WYSIWYG field, same as for the long description). The short description typically has a UL list and some standard formatting in my case.
I was very surprised to see that all html tags are stripped from this short description field.
One workaround would be to add an extra WYSIWYG product field named "short description 2" and link that field to a paragraph field in the template. I have tested this and it works. BUT it's confusing to have 2 "short description" fields. Also lots of work to move content from one field to another, when there are hundreds of products.
So can you supply me with another solution that does not strip formatting and that works with the default "short description" field?
I have looked at previous questions about the same thing, but these seem to be very old and involve menus that I cannot find in my version of Toolset (Views -> Compatibility for example).
Hi,
Thank you for contacting us and I'd be happy to assist.
Based on what you've shared, I understand that you're using the "Product short description" field that is offered by the WooCommerce plugin in the products post type.
If that is correct, WooCommerce stores the content of that field as the post's excerpt field. To show its content, keeping the HTML formatting, you can register a custom shortcode:
function custom_short_description_func( ) {
return get_the_excerpt();
}
add_shortcode( 'custom_short_description', 'custom_short_description_func' );
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
After that, you can show the content of this field in your template using this new shortcode:
[custom_short_description]
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
My issue is resolved now. Thank you!