[wp-trac] [WordPress Trac] #11394: Image shortcode

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 9 17:41:35 UTC 2010


#11394: Image shortcode
-----------------------------+----------------------------------------------
 Reporter:  caesarsgrunt     |       Owner:                          
     Type:  feature request  |      Status:  new                     
 Priority:  normal           |   Milestone:  3.1                     
Component:  Media            |     Version:  2.9                     
 Severity:  normal           |    Keywords:  needs-patch dev-feedback
-----------------------------+----------------------------------------------

Comment(by Otto42):

 Whoops. Pasting error. Here's the fixed code example for above:

 {{{
         global $post;
         if ( preg_match_all('/<img (.+?)>/', $post->post_content,
 $matches) ) {
                 foreach ($matches[1] as $match) {
                         foreach ( wp_kses_hair($match, array('http')) as
 $attr)
                                 $img[$attr['name']] = $attr['value'];
                         echo $img['src'];
                         echo $img['class'];
                         }
                 }
         }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11394#comment:47>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list