• I’m now using the Podcasting plugin and it seems to work OK but I would like to know how to place the podcast enclosure/player where I want it. Right now I have the more…. thing activated and I would like to have the player right after more. Is there a way to do that by putting some tag directly in the post, without the player showing up in the middle of the post on the main post page, or better yet some tag I can put on my index page to place it exactly where I want in some div?

    Thanks.

Viewing 15 replies - 1 through 15 (of 32 total)
  • Peter, the Podcasting player is very flexible in placement. When you press the “Send to Editor” button, it outputs some code like [podcast]URL[/podcast]. Just move that code to where you want the player to display. That’s all you need to do.

    Thread Starter peteraltenberg

    (@peteraltenberg)

    Thanks for the reply, but the problem is I’m using <!–more–> in my post. If I put that [podcast]URL[/podcast] before the <!–more–> it works, but then the player is position sort of strangely before the <!–more–>, and when I go to the single page for the post the player is plopped in the middle of the post text. If it’s after the <!–more–> it doesn’t show up at all until I go to the single post page. I tried putting the [podcast]URL[/podcast] in the Excerpt field and then placing that field in my index file but that didn’t work.

    Maybe there’s another way to place it somewhere, some HTML thing in the post? Or maybe there’s a different way to do the “more” thing? I suppose I could have the content with my own more link to the single page and then on the single page put the full text from Excerpt. I can try that but even if it works it seems a bit clumsy.

    What I’d really like is to have complete control of where it’s placed by separately calling it from my index page, if that makes sense.

    Thanks.

    Thread Starter peteraltenberg

    (@peteraltenberg)

    OK, I tried using have the partial post with the [podcast]URL[/podcast] on my index page and then have the full post on my single page using the Excerpt but the problem is then I cannot have the player on the single page. [podcast]URL[/podcast] doesn’t work in the excerpt. I guess it WP doesn’t process the excerpt the same way as the content. Would be nice if that worked and I could place the Excerpt (or maybe Custom field) where ever I want on my index template page. Any ideas?

    Are you familiar with some basic PHP coding? If so, I could write a small snippet that you could adapt for automatic placement in your theme.

    I’ve been trying to use this to place it in my Podcast post excerpt. But it doesn’t appear to work there either…

    I’d be interested in the PHP code to do something like that. But it’d be great if it could be used in the excerpt out of the box, if that’s possible.

    Thread Starter peteraltenberg

    (@peteraltenberg)

    If you could send me a snippet of code for my theme that would be great. I’m familiar enough with PHP coding to figure out how to use some code.

    Thanks!

    Here you go guys, this snipped of code will loop through all the podcasts on a given post, and display the player. You can add some if statements to change when it displays, or customize the output within the loop.

    <?php
    
    while ( $podcast = get_post_meta($post->ID, 'enclosure', false) )
    {
         $podcast = explode("\n", $podcast);
         $podcast_details = unserialize($podcast[3]);
    
         // echo $podcast[0]; // The URL for the enclosure.
         // print_r($podcast_details); // The iTunes details for the podcast.
    
         echo podcasting_shortcode(array('type'=>'mp3'), $podcast[0]); / Output the player. Change mp3 to video for video player (beta only).
    }
    
    ?>
    Thread Starter peteraltenberg

    (@peteraltenberg)

    Thanks for the code. When I put this code in on my theme page it makes the page go into an infinite loop displaying audio players over and over on the page and I have to kill the browser. I only have one podcast per post, can you tell me how to make it work for just one podcast, then it won’t loop I would think. Or am I doing something wrong. I assume I don’t need to put the [podcast]URL[/podcast] code in the post itself, right?

    Thanks very much for your help.

    Well, if you’re only anticipating one podcast per post, try this:

    $podcast = get_post_meta($post->ID, 'enclosure', false);
    
    $podcast = explode("\n", $podcast);
    $podcast_details = unserialize($podcast[3]);
    
    // echo $podcast[0]; // The URL for the enclosure.
    // print_r($podcast_details); // The iTunes details for the podcast.
    
    echo podcasting_shortcode(array('type'=>'mp3'), $podcast[0]); // Output the player. Change mp3 to video for video player (beta only).
    Thread Starter peteraltenberg

    (@peteraltenberg)

    Brilliant, thanks very much. I actually just figured that out, to take the ‘while’ loop out. I’m very slowly getting the hang of php.

    Thanks again.

    Thread Starter peteraltenberg

    (@peteraltenberg)

    OK, sorry but another glitch. The player is now showing up where I want it but it’s not finding the sound file. I did a test and put the player back in the post (like normal with a ‘send to editor’) and the player finds the sound file, but when I have the player in the theme with the code you gave it doesn’t find the sound file, says “error opening file”.

    Thanks for the code, CM. I’m not quite as handy with PHP as I wish. But I’ll probably figure it out at some point soon. I think it’d be handy if at some point in the future Podcasting’s settings page had a “Include Player in Excerpt as Well” option tick box.

    I’ve been frustrated lately because there doesn’t seem to be any Podcast theme developers for WordPress. Video Game review sites, Magazines, Image Blogging. But no Podcast specific themes. So this stuff helps me make a “Recent Podcasts” sidebar to view the most recent episodes of the show…

    Thread Starter peteraltenberg

    (@peteraltenberg)

    Sorry to bother again but I got the audio player where I want it but it isn’t finding the audio file correctly. Any Ideas? Maybe it’s easier to skip the Podcasting plugin and player and just link to an audio file?

    Also, I don’t understand completely what the feed URL should be for iTunes, just the location of the audio files?

    I apologize for all the errors. I haven’t been at my main development machine all weekend and could not test my code. I just corrected the issue which was present in that code:

    <?php
    
    $podcast = get_post_meta($post->ID, 'enclosure', false);
    
    $podcast = explode("\n", $podcast[0]);
    $podcast_details = unserialize($podcast[3]);
    
    //echo $podcast[0]; // The URL for the enclosure.
    //print_r($podcast_details); // The iTunes details for the podcast.
    
    echo podcasting_shortcode(array('type'=>'mp3'), $podcast[0]); // Output the player. Change mp3 to video for video player (beta only).
    ?>

    Regarding the iTunes feed URL, I’m not sure what you’re referencing. Where are you seeing this in Podcasting?

    Saberj, I’ll look into figuring out why excepts aren’t working and try to get a fix in the next version.

    Thread Starter peteraltenberg

    (@peteraltenberg)

    Thanks very much once again for the code. Now it’s working fine. Well, it plays now but there’s one small thing, none of the data shows up in the player when it’s playing, like author and length. Isn’t that supposed to show up? Here’s what’s showing up in a the enclosure:

    https://www.howpositiveareyou.com/feed/podcast/HindiAd.mp3
    727357
    audio/mpeg
    a:5:{s:6:”format”;s:14:”default-format”;s:8:”keywords”;s:0:””;s:6:”author”;s:0:””;s:6:”length”;s:0:””;s:8:”explicit”;s:0:””;}

    Sorry about the unclearness of the URL for the feed. I want to have two links in my template to the feed one going to the normal RSS2 and one that opens up in iTunes. Right now I have it set to itpc://www.howpositiveareyou.com/?feed=atom. Is that correct? In my Podcasting settings it says the “Podcast feed address (URL):
    https://www.howpositiveareyou.com/feed/podcast/&#8221;. So what should the link be for RSS and itpc on my template page?

    Thanks again.

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Custom placement of podcast enclosure’ is closed to new replies.