Skip Navigation

[Resuelto] How do add a $ sign and the field value to a shorcode?

This support ticket is created hace 5 años, 11 meses. 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)

This topic contains 3 respuestas, has 2 mensajes.

Last updated by Nigel hace 5 años, 11 meses.

Assisted by: Nigel.

Autor
Mensajes
#765258

How do add a $ sign and the field value to a shorcode? Currently if i put a $ in the shortcode it breaks the code. ANd if i put it in the as static text it always displays even when the field is empty.

thanks,

#765906

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

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

Screen Shot 2018-04-30 at 09.13.07.png

I'm not sure which kind of field you are trying to output, but for simple fields when you insert them using the Fields and Views button you will see an option for formatting where you can insert the $ sign, and that will generate a shortcode with a format attribute, like so:

[types field='some-number' format='$ FIELD_VALUE'][/types]
#767177

thanks for your response, though I am using advanced custom fields number field. So when i click views and fields, then i click "Load non-Types custom fields"

any thoughts?

thankyou

#767356

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

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

We don't have any options for formatting non-Types fields.

If you want to conditionally show a $ sign only when a non-Types field is not empty then you would need to wrap the whole section (the $ sign and the wpv-post-field shortcode used to output the number) in a conditional statement that first tests whether there is a value set for the number field.

See https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/

If inserting via the GUI in your case the source will be the wpv-post-field shortcode, where you will have to manually add the field name once it is inserted.

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