Skip Navigation

[Gelöst] Custom field output as HTML attribute

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.

Our next available supporter will start replying to tickets in about 6.51 hours from now. Thank you for your understanding.

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by giuliaS vor 6 Jahre, 6 Monate.

Assigned support staff: Minesh.

Author
Artikel
#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: Englisch (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!