WordPress.org

Forums

Audio Player
insert_audio_player doesn't work with rss (2 posts)

  1. gekido
    Member
    Posted 4 years ago #

    I've been working on a site with a ton of audio content that we've setup using the 'insert_audio_player' function, like so:

    // if there is an audio file, show player
    if (function_exists("insert_audio_player")) {
    	$audiofile = get_post_meta($post->ID, audio, true);
    	$author = get_the_author();
    	$podcasttitle = get_the_title($post->ID);
    	// do we have one?
    	if($audiofile) 	{
    		insert_audio_player("[audio:".$audiofile."|titles=".$podcasttitle."|artists=".$author."|width=100%]");
    	?><a href="http://www.mysite.com/audio/<? echo $audiofile; ?>">Click to Download the Audio File</a><?
    	}
    }

    Each audio file is setup as a custom field called 'audio' which the above then uses to render the player etc.

    The problem (which is a major one) is that using the 'insert_audio_player()' function doesn't behave the same as using the [audio: file.mp3] shortcode and the audio content is completely ignored for things like podcasts & other rss content.

    I have been fighting with this for waaay too long now and finally did some testing of some simple [audio: file.mp3] short codes added directly into post, and noticed that these shortcode links behave completely differently than using the include_audio_player() function does.

    Specifically, if you use [audio: myfile.mp3] directly in a post, when saving the post, there is a new custom field called 'enclosures' added to the post that contains the info required for an rss feed, ie byte size & entry name

    So, my question is: how do I fix the 'include_audio_player()' function so that it properly adds the 'enclosure' custom field for my rss feeds?

    Thanx in advance,

  2. gekido
    Member
    Posted 4 years ago #

    after digging through the source and trying to get my head wrapped around how things are working it appears that the main issue that i'm looking at is the fact that the 'include_audio_player()' function simply isn't designed or intended to work as a part of a post or page template, but is intended for 'outside the loop' usage...which is unfortunate because it's much easier for me to train clients how to add an 'audio' custom field and paste the name of their mp3 in than have them remember the syntax of the audio shortcode.

    Having said that, I'm going to experiment with ID3 tags (they don't / haven't tagged their mp3's up to this point) so this may be a moot point / not a problem going forward.

    we'll see.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic