Skip Navigation

[Résolu] Set Div body class with custom field

This support ticket is created Il y a 4 années et 6 mois. 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 réponses, has 2 voix.

Last updated by seanN-5 Il y a 4 années et 6 mois.

Assisted by: Luo Yang.

Auteur
Publications
#1331931

I am trying to add a class to a <div> using a custom field.

Here is the code I am trying:

<div class="[wpv-post-field name='performance-ed-class']">[types field="end-date"][/types]</div>

This is what I am getting... no class added: <div class="">September 4, 2019</div>

#1331997

Hello,

I assume the custom field "performance-ed-class" is created with Types plugin, Types will add pre-fix "wpcf-" before the field slug, so you can modify your codes as below:

<div class="[wpv-post-field name='wpcf-performance-ed-class']">[types field="end-date"][/types]</div>

And test again

#1332025

My issue is resolved now. Thank you!

Luo, thanks for the fast response. I found another solution to what I was trying to do (hide a field is a certain post type). I wound up using the conditional logic to say if is post type A then hide. I'm going to duplicate the view and try your solution as well.

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