admin管理员组

文章数量:1287858

This is what i am trying to achieve: --

Code i am trying in wordpress:-

function html5_insert_image($html, $id, $caption, $title, $align, $url) {

    $html5 = get_image_tag( $id, $alt,$url, '', $align, $size );
    $html5 = "<figure id='post-$id media-$id' class='align-$align'>";
    $html5 .= "<img src='$url' alt='$title' />";
    if ($caption) {
      $html5 .= "<figcaption>$caption</figcaption>";
    }
    $html5 .= "</figure>";
    return $html5;
   }
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );

issue is here url is not getting printed image source ,i tried many code from post from stack or other source but not working.

Or will be best if anyone can help with the code what i wanted. I mean with first example.

Theme support for HTML5 is added theme.

本文标签: How to wrap normal image tag with figure HTML5 element