Skip Navigation

[Resolved] I want to add a class to a WYSIWYG custom field

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to add a wrapper div around a Types WYSIWYG field with a custom class?

Solution:
Just add the div yourself in the markup where you insert the field with the required class.

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by gabrielB 5 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#1129744

Hi there.

I have a WYSIWYG custom field that I use throughout this website. It is a standfirst (an introductory paragraph) and I have styling for it. I'd like to apply the class .standfirst to the wrapper div that Types creates.

#1129973

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Gabriel

If you are talking about outputting the wysiwyg field with a types shortcode, then no wrapper div is included, the content itself is printed directly.

You can just add your own wrapper div, like so:

<div class="standfirst">[types field='whizzy'][/types]</div>
#1130094

Thanks Nigel, bit this is a custom build I'm working in PHP.

#1130517

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

You are using types_render_field to output the wysiwyg field?

Why can't you just echo the markup with a div that includes the class around it?

#1130524

Yeah, sorry about that. I thought there was a "php" way to do it.

Complete brainfart.

Thanks for your help and sorry for wasting your time.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.