Advanced Custom Fields Add Class to Element

I’m using Advanced Custom Fields’ flexible content area in a WordPress theme that I’m developing. One of my sub_fields requires a textarea.

When I make my get_sub_field call from my template it is already wrapped in <p></p> tags. How do I go about adding a class to that paragraph?

Read More

Example:

get_sub_field('textarea');

Output:

<p>This is my textarea.</p>

Desired:

<p class="my-class">This is my textarea.</p>

Thanks for your help!

Related posts

Leave a Reply

2 comments

  1. Go to your Textarea custom field settings and change “Automatically add paragraphs” to none.

    So WP-admin-> Custom Fields -> Field group -> then your field group-> edit textarea-> look for “Controls how new lines are rendered”