Skip Navigation

[Resolved] Accessing a custom field in a template

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 10 months, 2 weeks ago.

Assisted by: Waqar.

Author
Posts
#2611363

I have a template with a button. When I set the button to a dynamic source and select: post source -> source -> select a field, all of the other custom fields are listed as a choice but not the field I want to select.

hidden link

#2611457

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

In the Toolset's 'Button' block, there are two options to select the dynamic source:

a). 'Dynamic Button Text' option would show all types of custom fields.

b). 'Dynamic Button URL' option would only show the 'URL' type custom fields.

Are you noticing the same and which type of field is missing in your case?

regards,
Waqar

#2611959
Screen Shot 2023-06-01 at 10.15.00 AM.png
Screen Shot 2023-06-01 at 10.14.17 AM.png

Hi there - Let me try to explain better. I have a button block (Chorus Email) - in a template (a single post for Choruses) with a dynamic link.

The link is
Post source - Current Chorus
Source - Field Group for Chorus
Field - (In this dropdown the field "Chorus Email" isn't an option.) <- THIS IS THE PROBLEM!

I have attached screenshots from the "custom fields for choruses" and the field dropdown.

Please help.
Thanks,
Kim

#2612977

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Kim,

Thank you for waiting, as I had an unusually busy forum queue after the weekend.

I've performed some tests with both the 'Button' blocks ( the one from Toolset and the other from WordPress ) and both of them only support the 'URL' type fields for the dynamic link's source.

The few workarounds that I tested to make it work with the 'Email' type field didn't work either. One alternative that you can use to generate a button with a similar markup is to use the Types Fields API shortcode, in the custom HTML:
( ref: https://toolset.com/documentation/customizing-sites-using-php/functions/#email )


<div class="wp-block-buttons is-layout-flex">
<div class="wp-block-button">
<a class="wp-block-button__link wp-element-button" href="mailto:[types field='email-field-slug' output='raw'][/types]">Button text</a>
</div>
</div>

The above HTML code can be included in a 'Fields and Text' block and you'll replace 'email-field-slug' and 'Button text', with the actual email field's slug and the desired button label text, respectively.

I can understand that it will not give you full control over the design aspect of this button. But if you need some assistance with adding some custom CSS code for its fine-tuning, please let me know.

regards,
Waqar

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