Created
August 13, 2013 19:32
-
-
Save WebEndevSnippets/6224805 to your computer and use it in GitHub Desktop.
Plugin: Add rel="prettyPhoto" attribute automatically as image is inserted into post
This file contains 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
add_filter( 'image_send_to_editor', 'we_insert_img_rel_attrib', 10, 6 ); | |
/** | |
* Add rel="prettyPhoto" attribute automatically as image is inserted into post | |
* Requires PrettyPhoto JS enqueue | |
*/ | |
function we_insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { | |
$rel = "<a rel=prettyPhoto"; | |
if ($url) {$html = str_replace("<a",$rel,$html);} | |
return $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment