Skip Navigation

[Résolu] 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.

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.

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

Last updated by giuliaS Il y a 6 années et 4 mois.

Assigned support staff: Minesh.

Auteur
Publications
#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: Anglais (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!