Skip Navigation

[Résolu] Audio Embed Not Working for Dynamic Content

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The problem here is that the user wanted to pass our Types shortcode into the wordpress default embed shortcode.

Solution:

Unfortunately the [embed][/embed] shortcode by wordpress doesn't support the use of shortcodes to provide data for the field.

In this case We recommend that you use our Embedded Media custom fields to store items that you want to display on your page.

This support ticket is created Il y a 3 années et 1 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Ce sujet contient 6 réponses, a 2 voix.

Dernière mise à jour par aaronM-9 Il y a 3 années et 1 mois.

Assisté par: Shane.

Auteur
Publications
#2196039

I am trying to embed some audio into a Content Template. The link works when copy/pasting the URL into the HTML but does not work when populating from the custom field, which contains the exact same data. Obviously I need it to come from the custom field so it is dynamic from post to post. Can you help troubleshoot?

<h2>Audio</h2>
<p>[embed][types field='media-source-aws-audio' output='raw'][/types][/embed]</p>
<p>[embed]<em><u>lien caché</u></em>;

The first line with embed code works and the second line does NOT work. The URL pointing to the content is identical in both cases.

#2196933

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Aaron,

The problem here is that the [embed] wordpress shortcode doesn't allow the nesting of shortcodes. It requires that you provide the actual URL.

What kind of custom field are you using? Is it an Audio field or an Embedded media field. If its an audio type custom field then it should render the link in an embedded media player.

Thanks,
Shane

#2198909

Hi Shane,

The field is a URL. Is there a way to make it work this way or do I need to either convert it to a media field (not sure how to do that) or use a different shortcode? My preference is to keep the field stored as a URL because I may change the coding and/or player used to display the content, so keeping it as a URL allows me some flexibility in that regard.

- Aaron

#2199769

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Aaron,

The problem isn't the field itself.

Its the fact that wordpress doesn't allow for the nesting of their shortcodes. This means that you're not able to use a shortcode inside the [embed] shortcode.

The only solution I can think of is to create a wrapper shortcode for the embed shortcode which will process our Types shortcode before passing it to the embed shortcode.

However just passing it to the [embed] shortcode won't work given the changes in wordpress some years ago. Are you familiar with how to create custom shortcodes?

Please let me know.
Thanks,
Shane

#2199935

Hi Shane,

Does a media field store the actual file or does it render a embedded player from a URL? If the latter, is there an easy way to convert the field from a URL to a media field? Then I wouldn't need to use the [embed] shortcode? Most of the URL's are to YouTube, Vimeo, or an audio or video file stored at Amazon Web Services.

Regarding writing custom shortcodes, this sounds like the best solution but is not my area of expertise and I would have a hard time knowing where to start . I've done it before but usually with input from somebody else.

- Aaron

#2199987

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Aaron,

The embedded media field would work for this because you are able to post your URL into the field. This will then render your field using the embedded player for wordpress.

If you use our embedded media field then you wont need to worry about using the wordpress embed shortcode.

Thanks,
Shane

#2201867

Okay I switched the field type to embedded media and it works. I also did the same for my video and that also worked. The only problem is embedding content from Odysee, which I'm guessing you don't support. I will put in a feature request for that. Thanks.

- Aaron