Skip Navigation

[Resolved] audio player problem

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user was not able to render an audio control with Toolset shortcodes inside an Elementor Pro template.

Solution:
It seems that the Elementor Pro shortcode module does not allow to render shortcodes inside

To work around it, create an assigned content template to generate the audio control and use it inside Elementor. Elementor does not offer a way to insert a content template, we can only insert views. We can insert the content template with a shortcode instead.

[wpv-post-body view_template='Audio control content template']

Relevant Documentation:
https://toolset.com/forums/topic/audio-player-problem/#post-1623253

This support ticket is created 4 years, 7 months 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: Africa/Casablanca (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by signisF 4 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#1622641

I'm using Elementor. I have custom field for piece of the URL of the MP3 file.

I want use like this:
<audio controls><source src="hidden link field='audio'][/types].mp3" type="audio/mpeg"></audio>
but the playr doesn't work.

However, if i use this:
hidden link field='audio'][/types].mp3">listen
the link is good

Whta's the problem?

#1623103

Hello and thank you for contacting the Toolset support.

To better understand this issue, I'll need more details. What kind of fields are you using?
Preferably, access to your website will let me understand various aspects of the problem faster. If you would agree, your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
I'll need to know, which view, which CPT, field, URL, as many details as possible.

I would also need to know, what result would you expect? An audio control to play the mp3? Automatically or manually?

#1623253

Thank you for your feedback and the credentials.

You are displaying articles using an Elementor Single Template and using an Elementor shortcode module/widget. It seems that this module does not allow to render shortcodes inside <audio> or <source> tags. Check this screenshot hidden link

A workaround would be to use an unassigned content template that will render the audio control and use it with a shortcode inside the Elementor shortcode module.
I tested it and you can see that the first control after the title "AUDIO" is working, using a content template "Test audio output":

[wpv-post-body view_template='Test audio output']

https://toolset.com/documentation/user-guides/views/views-shortcodes/#vf-153372

I hope this helps. Let me know your feedback.

#1624015

Thank you so much for your help.

I've been trying to understand the process. I think I realized:

1st - create a template with the code we intend to work with;
2nd - create a view to call this template; this view only serves to generate the shortcode that we will place in the Elementor template. Then, I can delete the view.

Am I right?

#1624189

1st - Yes, but the content template must not be assigned to any custom post type.

2nd - Only if you want to create the view. Which is probably unnecessary.
Currently, Elementor only allows inserting Toolset views in his structure. It does not offer a module to insert a content template. To work around it, we either:
- Insert the content template with a shortcode. "wpv-post-body" shortcode using the "view_template" attribute.
- Create a view that will use the content template and use it inside Elementor. In this case, we need to make sure to correctly configure the view. A view is meant to query and display a LIST of posts. We can pass which posts (the current one) to the view using a shortcode attribute("wpv-view" shortcode using "ids" attribute). But in that case, why not insert a content template instead.

Does it make sense? If not, please read more about the differences here:
- https://toolset.com/glossary/template/
- https://toolset.com/glossary/view/

Let me know if you have any questions.

#1624259

Ok.
My idea is to create a post template in Elementor, where I will use the Toolset shortcodes.
I will try to build some shortcodes as you say and then give feedback.
Thanks again.

#1624287

Awesome!

I'll set the ticket as waiting for your feedback, it should be kept open for three weeks. Once you replied, it will appear back on my list.
If you want to discuss anything else, please open a new ticket.

All the best.

#1625403

My issue is resolved now. Thank you! Thank you so much, Jamal. You had been fantastic.