[wp-trac] [WordPress Trac] #23572: Add functions to parse Audio / Video data out of arbitrary content or a post

WordPress Trac noreply at wordpress.org
Tue Mar 26 20:46:59 UTC 2013

#23572: Add functions to parse Audio / Video data out of arbitrary content or a
 Reporter:  wonderboymusic                     |       Owner:
     Type:  enhancement                        |      Status:  new
 Priority:  normal                             |   Milestone:  3.6
Component:  Post Formats                       |     Version:
 Severity:  normal                             |  Resolution:
 Keywords:  needs-unit-tests has-patch commit  |

Comment (by lancewillett):

 Replying to [comment:23 wonderboymusic]:
 > added 3 functions:
 > `the_audio()` and `the_video()` are just wrappers for `get_the_media()`,
 which contains all of the black voodoo to return the HTML for an audio or
 video and remove it from the global post's content when appropriate. Does
 a post format check for meta only

 Lookin' awesome.

 One thing noticed in testing, if the video output is a bare URL it
 probably needs to be converted to embed before returning. @obenland noted
 in IRC, we should probably check there in {{{get_the_media()}}} whether
 the post meta value is an embeddable URL, similar to how we handle oEmbed
 in regular content.

 Could you also add a case for {{{the_image()}}}?

 Since it doesn't involve post meta, would be first checking the first
 attachment, then fallback to first image found in the post content.

 1. {{{ get_attached_images( ... ) }}} -- take the first result, return as
 output HTML
 2. {{{ get_content_image( ... ) }}} -- take 1st result, return as output

 @obenland Can you please add your notes here about the {{{$pages}}} global
 versus {{{$post->post_content}}}?

Ticket URL: <http://core.trac.wordpress.org/ticket/23572#comment:24>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list