hluu
Forum Replies Created
-
Oh, sorry, I just realize the default powerpress player just uses the audio tag so the player is the browser’s. You have nothing to do with it. My apology.
Thank you, Angelo, that works.
I wouldn’t want the player to pre-load the file, that’d be too slow. I just want it to display the duration if it has the metadata.
Incidentally, if it doesn’t know the duration, maybe it should display blank rather than 0:00, which is odd looking.
Forum: Plugins
In reply to: [Postie] Powerpress media fileThis turned out pretty straightforward, as wordpress API makes it easy. Posting code here. Hope this’ll help someone.
<?php /* Postie add-on to extract [enclosure] short code and insert into meta table the way powerpress does it Take, for example, [enclosure type="audio/mpeg" url="http://feeds.soundcloud.com/stream/9966888" length="854664" duration="00:23:11"]/> and add_post_meta 'enclosure' with value http://feeds.soundcloud.com/stream/9966888 854664 audio/mpeg a:1:{s:8:"duration";s:8:"00:23:11";} */ $enclosure = ''; function extract_enclosure($post) { //do something here like update $post['post_content'] global $enclosure; // look for a line containing // [enclosure ....] // // may have spaces or > before and spaces after, but must be on line by itself $re = '/(\R+|^)[ >]*\[enclosure (.+)?\] *(\R+|$)/m'; if (preg_match($re, $post['post_content'], $m)) { // use SimpleXMLElement to parse attribute $xml = new SimpleXMLElement("<element {$m[2]} />"); if ($xml) { $enclosure = $xml[0]['url'] . "\n" . $xml[0]['length'] . "\n" . $xml[0]['type'] . "\n" . 'a:1:{s:8:"duration";s:8:"' . $xml[0]['duration'] . '";}'; } // replace multiple preceding and trailing \n with 1 $nl = $m[1] ? "\n" : ''; $nl .= $m[2] ? "\n" : ''; $post['post_content'] = preg_replace($re, $nl, $post['post_content'], 1); } return $post; } function insert_enclosure($post) { global $enclosure; if ($enclosure) { add_post_meta($post['ID'], 'enclosure', $enclosure, true); } return $post; } add_filter('postie_post_before', 'extract_enclosure'); add_filter('postie_post_after', 'insert_enclosure'); ?>Forum: Plugins
In reply to: [Postie] Powerpress media fileOk, I hope I can do this, thanks 🙂
Forum: Plugins
In reply to: [Postie] Powerpress media fileThank you, but I think I went down the wrong path with the [powerpress] shortcode, since that only affects what shows up visually, ie, it will show a media player in the post.
What I need is to be able to attach a URL to a media file so that it will show up in the feed as an RSS enclosure and be recognized as a podcast episode.
https://en.wikipedia.org/wiki/RSS_enclosure
Internally, this isn’t in the post table, but the postmeta table with meta_key ‘enclosure’
- This reply was modified 8 years, 4 months ago by hluu.
Forum: Plugins
In reply to: [Postie] Powerpress media fileThank you for replying. I know how to do it in the WP editor.
I’m trying to do it via Postie (post by email). I need to do the equivalent of adding the media URL field in the editor screen — via email.
thank you. I managed to do it myself 🙂
I mean that in Theme > Default Texts, I have ‘Text for item count’ set to ‘# of rooms’ and that is how it shows in the booking form.
But when sending email notifications (Your booking request has been sent/accepted/etc), if I add [details] to the email template, the label shows up as ‘Item Count’ and not ‘# of rooms’, which is confusing to the end user.
like this
Reservation dates January 31, 2018-February 1, 2018
Item Count 4