Last active
June 17, 2016 19:15
-
-
Save tarikcayir/8884043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change image tag | |
*/ | |
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 ); | |
function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) { | |
$src = wp_get_attachment_image_src( $id, $size, false ); | |
$html5 = "<figure id='post-$id media-$id' class='align-$align'>"; | |
$html5 .= "<img src='$src[0]' alt='$alt' />"; | |
if ($caption) { | |
$html5 .= "<figcaption>$caption</figcaption>"; | |
} | |
$html5 .= "</figure>"; | |
return $html5; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment