kilokeith/soundcloud-soundmanager-player

Wordpress & Soundmanager2

leatherboundbooks opened this issue · 4 comments

Hey Keith, apologies for all the questions - was just curious if there are any particular things to take into account in order for this to work with a Wordpress theme? ie. when writing out the correct path to say the swf directory can it still just be the absolute/relative path, or is it nessecary to do something like <?php bloginfo('template_url'); ?>/swf to get the script to find the movie correctly??

I keep returning SOUNDMANAGER2 TIMEDOUT!! in console, so Im assuming something is not correct with the path to the swf even though ive been double checking it like mad.

Sounds like your path to the soundmanager swfs is incorrect. It's defined at the beginning of the script. You'll want to remove that part and redefine it before including the scripts. The path should probably set to an absolute url of your template directory.

soundManager.setup({
      url: 'http://yoursite.com/wp-content/themes/yourtheme/swf/'
});

Man, I should have just tried a freaking absolute path all along, just thought that was ludicrous to need to do but makes sense now in retrospect...thank you for the tip.

I tried adding in <?php bloginfo('template_url'); ?>/my_directory but that was throwing me an error most likely due to poor syntax.... Not too sure how to add a php/wordpress template tag into javascript like that so I guess an absolute path is the way to go I suppose.

You could include a javascript variable in the header of your page (in your header.php)

<script>
    var base_url = '<?=home_url();?>';
    var theme_url = '<?=get_template_directory_uri();?>';
</script>

That way you'd always have a dynamic absolute path for your javascript.

soundManager.setup({
      url: theme_url+'/swf/'
});

But that's about all the WP help I care to give.

No worries. Thanks for your time.