Skip to content

Instantly share code, notes, and snippets.

@holisticnetworking
Forked from rezen/wp.filter.php
Last active October 18, 2018 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save holisticnetworking/753753ba67a369214b82 to your computer and use it in GitHub Desktop.
Save holisticnetworking/753753ba67a369214b82 to your computer and use it in GitHub Desktop.
Filter Image insert for WordPress
public function hn_insert_image( $html, $id, $caption, $title, $align, $url ) {
$html5 = "<figure id='post-$id media-$id' class='align-$align'>";
$html5 .= "<img src='$url' alt='$title' />";
$html5 .= "<figcaption class="wp-caption">$caption</figcaption>";
$html5 .= "</figure>";
return $html5;
}
add_filter( 'image_send_to_editor', array( &$this, 'hn_insert_image' ), 10, 9 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment