Skip Navigation

[Resolved] Can you nest fields within fields?

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by Beda 7 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#429242

I am trying to: nest fields within fields in a Content Template.

I have the following three fields:

[types field='amazon-link'][/types][types field='disc-type' separator='/'][/types][types field='amazon-price' format='FIELD_VALUE'][/types]

I would like to have the "amazon-link" field encompass the other two fields (disc-type, amazon-price) so that the resulting line is a link. Something along these lines:

[types field='amazon-link' ((field='disc-type' separator='/')": $"(field='amazon-price' format='FIELD_VALUE')) target='_blank'][/types]

Can Toolset do this? I've not found any documentation that indicates how to nest fields within other fields.

#429383

Likely not. Those are enclosed ShortCodes and you would put values between the opening and closing tag ([types field='amazon-link']value here[/types])

As first I need to know the type and contnet of those Fields.

Then I need to know what exactly you want to produce.

Please can you provide me this info?

You can use nested ShortCodes as elaborated here:
https://toolset.com/documentation/user-guides/shortcodes-within-shortcodes/

And here is a explanation why Types ShortCodes are enclosed:
https://toolset.com/faq/why-do-types-shortcodes-have-to-be-closed/

#429623

The workflow is this:
"amazon-link" is a URL to go to an Amazon page.
"disc-type" is the type of product: DVD, BD, 3DBD, 4KBD, digital copy or video-on-demand. This is a checkbox field, as the products vary in their iterations. This is also the main reason I want to use WP-Types for this purpose.
"amazon-price" is the price that Amazon charges for the product.

The end result would be this: <a href="hidden link" target="_blank">Amazon BD/DVD/DC price: $22.99</a>

If this can't be done, then it can't be done. But it seems such a simple concept: use the data entered in one field to represent another.

#429967

Well but what you want is a Link URL and a Link text.

So you can do this:

<a href="[types field='amazon-link'][/types]">Amazon [types field='disc-type' separator='/'][/types] price: $[types field='amazon-price' format='FIELD_VALUE'][/types]</a>

If you insert this in your Text Editor it will prodice a link like what you show me in your example.

You do not need to nest the ShortCodes.

Just pay attention to output the raw URL with your URL Field, so the "a href" receives the correct data.

The forum ‘Types Community Support’ is closed to new topics and replies.

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