Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Adicionando rel="lightbox" em todas as imagens do post automaticamente. Lembre-se de instalar o jquery lightbox (do Leandro Vieira - http://leandrovieira.com/projects/jquery/lightbox/).
- */
- function add_lightbox_rel($content) {
- $pattern = '/<a(.*?)href="(.*?).(bmp|gif|jpeg|jpg|png)"(.*?)>/i';
- $replacement = '<a$1href="$2.$3" rel=\'lightbox\'$4>';
- $content = preg_replace( $pattern, $replacement, $content );
- return $content;
- }
- add_filter( 'the_content', 'add_lightbox_rel' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement