Skip to content

Instantly share code, notes, and snippets.

@chriscoyier
Created March 26, 2014 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriscoyier/9784598 to your computer and use it in GitHub Desktop.
Save chriscoyier/9784598 to your computer and use it in GitHub Desktop.
// Figure Inserting
function html5_insert_image($html, $id, $caption, $title, $align, $url) {
$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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment