Skip Navigation

[Resolved] Custom field output as HTML attribute

This support ticket is created 8 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by giuliaS 8 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#302753

Hi, I need to use a custom field as HTML attribute. I'll try to explane:
I have a post with a color picker custom field. I want to use the output of this custom field as a backgrounfd color for a <div> element inside View plugin.
If i write something as:

<div style="background-color: [wpv-post-field name=??box-color??]">

it doesn't work. Can you help me please?

Same problem if I'd like to use the post link as target of the HTML <a> attribute.

#302878

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello and thank you for contacting Toolset support.

You should use types shortcode to get value of your custom field.
For example:

[types field="url"][/types]

Please refer following link for types API:
=> https://toolset.com/documentation/functions/

I'd like to use the post link as target of the HTML <a> attribute.
=> For this you should use shortcode [wpv-post-url].

Please refer following link for more information:
=> https://toolset.com/documentation/views-shortcodes/#wpv-post-url

#303354

Thanks a lot! Now it works!

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