i am dustin diaz

a JavaScriptr...

boosh.

don't worry about it.

Podcast entries have been 'odeoized'

One final thing before I take off to Boston, I just wanted to mention that the podcasts on WSwI now have a flash player where you can play the audio files directly on the site. Granted this shouldn't stop you from downloading them to your iPod to listen to them later, it's just an alternative that allows you directly play them in a more convenient manner.

So, first thing's first before I hear some of you cry "Now your webpage is not valid xhtml strict." Well, I can live with that for now. I can no doubt use JavaScript to embed the markup into the page, but I'm too lazy for that right now.

Otherwise, I thought I'd share just a bit on how easy this was to integrate into Wordpress. If you haven't noticed yet, Odeo is now offering (what I would like to call) "badge code." What that means is that for every audio file that is picked up into your feed via Odeo, there is code provided for you that you can embed into your webpages.

Alright. Simple enough. What I did with that code is pasted it directly into my single.php file within your current theme directory and added a bit of logic to it. Oh right, and before I had even done that, I already had a particular category called "Podcasts." That can be done simply by going into your wp-admin and clicking manage - > categories. Once that category has been added, it will have an id. Remember that id.

The next step is to open back up a podcast entry (a post) and add a custom "key/value" entry to that post. I called mine podcast_entry, then for the value I put the actual file name for the value (I didn't bother putting the full path, but I could have).

Then finally, within my singe.php file I went ahead and put the following code in

odeo integration code for wordpress podcasters

<?php

// Wordpress Developers, pay special attention that this

// occurs within "THE LOOP"

if ( in_category(17) ): // 17 is my 'podcasts' category

	$podcast_url = get_post_meta($post->ID,'podcast_entry',true);

?>

<!-- insert flash player if podcast -->

<object 

	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 

	codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" 

	width="476" 

	height="80" 

	align="middle">

	<param 

		name="allowScriptAccess"

		value="any" 

	/>

	<param 

		name="movie" 

		value="http://odeo.com/flash/audio_player_fullsize.swf?ver=1.03" 

	/>

	<param 

		name="wmode" 

		value="transparent" 

	/>	

	<param 

		name="flashvars" 

		value="audio_id=999097&valid_sample_rate=true&external_url=http://www.dustindiaz.com/downloads/podcasts/<?php echo $podcast_url; ?>" 

	/>

	<embed 

		src="http://odeo.com/flash/audio_player_fullsize.swf?ver=1.03" 

		width="476" 

		height="80" 

		allowScriptAccess="any" 

		type="application/x-shockwave-flash" 

		pluginspage="http://www.macromedia.com/go/getflashplayer" 

		flashvars="audio_id=999097&valid_sample_rate=true&external_url=http://www.dustindiaz.com/downloads/podcasts/<?php echo $podcast_url; ?>" 

		wmode="transparent">

	</embed>

</object>

<?php

endif;

?>

And with that, that's all she wrote. It was that easy. I hope someone else finds this useful.

this is who i am

Hi, my name is Dustin Diaz and I'm an Engineer @ObviousCorp. Previously @Twitter, @Google, and @Yahoo, author of Strobist® Info co-author of JavaScript Design Patterns, co-creator of the Ender JavaScript Framework, a Photographer, and an amateur Mixologist. This is my website. Welcome!

On this site I write about JavaScript. You can also follow along with my open-source work on Github.

This site is optimized and works best in Microsoft Internet Explorer 6.