Support

Account

Home Forums Front-end Issues Get each paragraph from acf WYSIWYG field

Helping

Get each paragraph from acf WYSIWYG field

  • Hi!

    I would like to get (then add custom class) each paragraph (p) from acf WYSIWYG field. Is it possible ?

    I already tried get_sub_field('text', false, false) but it doesn’t work since I have multiple “p” in my field and I need to separate them.

    Thank you for your help!

    (Sorry for my English, I’m not fluent..)

  • There isn’t any way to do this without parsing the returned text using a regular expression or otherwise parsing the returned string.

    My suggestion would be to use a container div that has a class and target the paragraphs in it.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.