Is there an easy way to get the first paragraph of a wysiwyg. In this instance I want to add it without the enclosing <p>
tags into a Facebook og:description
tag.
1 Answer
I used the hacksaw plugin:
{exp:eehive_hacksaw cutoff="</p>"}{copy}{/exp:eehive_hacksaw}
-
Glad you found a solution, but just NSM Better Meta or just a plain text-field in your field-group would have been cleaner IMO. Commented Nov 28, 2016 at 15:45
-
Yeah, this would include any HTML in the field, as well as images, tables, etc. And a WYSIWYG field doesn't necessarily have to contain any paragraphs. I'd suggest adding a plain textarea field for the Description. Or using an SEO plugin like SEO Lite. Commented Nov 29, 2016 at 17:38