Actually, the striptags
filter (which is just a wrapper for the PHP strip_tags function) removes all HTML tags except the ones you pass in.
In other words, if you want to remove <p>
tags, just use the striptags
filter without any parameters:
{# Will remove all HTML tags #}
<p class="slider--text">{{ product.intro|striptags|raw }}</p>
If there are other tags you want to retain, you'll need to pass those in:
{# Will remove all tags except <br> and <img> #}
<p class="slider--text">{{ product.intro|striptags('<br><img>')|raw }}</p>
For a different take on stripping tags, you can use the Retcon plugin (which I wrote). With Retcon, you can remove all <p>
tags (and only <p>
tags; retaining their contents as well as all other tags) easily by using the retconChange
filter:
<p class="slider--text">{{ product.intro|retconChange('<p>', false) }}</p>