Hi, I've set up a view and it's stripping the HTML out of the Post Excerpt.
I've tried using the following fix in my functions.php but it hasn't worked and I'm not sure why? https://toolset.com/forums/topic/views-strip-out-html-markup-form-excerpt/
child theme functions.php hidden link
Excerpt which is being stripped out:
hidden link
hidden link
Thanks
It's actually not a trivial thing, because of how character and word counts must be calculated when HTML tags are allowed in the contents. This customer's snippet worked up until quite recently, but I'm not surprised it doesn't work anymore. If you do a web search, you'll find there are tons of other posts out there that offer different custom code to try to make it work. You will see they are all slightly different and function more or less to different degrees. The short answer is HTML in the excerpt is not supported in Toolset or in WordPress, and we don't offer a shortcode or code snippet that provides that capability. Instead, you can use a WYSIWYG custom field if you want to support HTML, and use a Types field shortcode to insert the contents of that excerpt in a template. Let me know if you need assistance implementing a WYSIWYG field instead of the post excerpt.
Thanks for the quick answer. Yes I think it would be easier to move away from the post excerpt. Would you be able to point me to instructions on how to set up a Types Field Shortcode and a WYSIWYG custom field?
Sure, you can start here to see more about adding custom fields to the post editor screen: https://toolset.com/documentation/user-guides/using-custom-fields/
Then this page describes the shortcodes you can use to insert those custom fields in a template: https://toolset.com/documentation/customizing-sites-using-php/functions/
Click the orange "+More" link in any field type to display more examples. You don't have to write these shortcodes by hand, the system can generate them for you. Place your cursor in a post content or content template editor and click "Fields and Views" above the editor. You can select your custom field here and choose a few options. Then the system will insert the corresponding shortcode, automatically.