Skip Navigation

[Resolved] audio field – paste url

This support ticket is created 6 years ago. 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.

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 6 replies, has 2 voices.

Last updated by ScottM9386 6 years ago.

Assisted by: Waqar.

Author
Posts
#1138352

Hi,

the audio field in the post editor allows one to either upload a file or paste a URL - which is ideal for me.
But not so in the CRED form - it seems one can only upload a file. Is there a way to make it function the same as in the post editor?
I really need my users to have the option. I don't think adding a URL field will work for me because they need to listen to the audio in many places throughout the site...not sure the WP audio player would render an mp3 that is added via a url field.

thank you.
Scott.

#1138848

Hi Scott,

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

I'm afraid, the way the audio field is handled in the CRED form, it can't be used to accept a URL of the file directly.

But you can use the following workaround:

1. Instead of a single audio field, you can include two separate fields. First one can be an audio field, for a visitor who'd like to upload an audio file.

The second one can be a regular URL field, for someone who'd like to share a URL to an audio file, which is already uploaded somewhere else.

2. In your view, you can use URL field to generate an audio player, same as the one from the audio file, like this:


[audio src="[types field='audio-url-field' output='raw'][/types]"]

(note: please replace "audio-url-field" with the actual slug of your URL field)

You can read more about WordPress' own audio player shortcode at:
( ref: https://codex.wordpress.org/Audio_Shortcode )

I hope this helps.

regards,
Waqar

#1139027

Hi Waqar,

very interesting.
I will give it a try.

Thank you!

Scott.

#1139034

hmm...
doesn't seem to be working out.
If I use the external url method, using the shortcode to generate the audio player - and then later delete the url (lets say the user changes their mind and decides to upload instead) the audio player including the external file it's playing remains and there's no way to delete it - even though the post has been saved with NO external URL in the field. I've cleared all cache and still the same.

any ideas?

thanks!

#1139037

i guess I can get around it by using a condition

#1140160

Hi Scott,

Thanks for the update and your understanding is correct.

You can use conditions to display these fields, based on whether they have some values stored in or not.
( ref: https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/ )

For an even neater touch, you can also include a new radio or select type field to let the users choose between upload audio field or the URL field. Based on this selection, you can then hide or show the relevant field.

Let me know if you need any further assistance.

regards,
Waqar

#1140174

Hi Waqar
Yes - that's what I've done.

Thank you!

Best,
Scott.