I'm working on a Wordpress site, where all images inside posts are linking to the corresponding attachment pages. I want to use a lightbox but obviously this would require changing all the links back to the media files directly (e.g. xyz.jpg).
The site has a significant number of posts and images so it would be impossible to do this manually.
Does anyone know of solution that would simply replace - in bulk - all of the image links to link to the media file, instead of the attachment page?
I'm working on a Wordpress site, where all images inside posts are linking to the corresponding attachment pages. I want to use a lightbox but obviously this would require changing all the links back to the media files directly (e.g. xyz.jpg).
The site has a significant number of posts and images so it would be impossible to do this manually.
Does anyone know of solution that would simply replace - in bulk - all of the image links to link to the media file, instead of the attachment page?
Share Improve this question edited Apr 17, 2014 at 15:30 Pim asked Apr 17, 2014 at 13:54 PimPim 1,1521 gold badge11 silver badges26 bronze badges 01 Answer
Reset to default 2I found a nice snippet at this site for your functions.php
that does the trick:
add_shortcode( 'gallery', 'file_gallery_shortcode' );
function file_gallery_shortcode( $atts ) {
$atts['link'] = 'file';
return gallery_shortcode( $atts );
}
I'd actually been looking unsuccessfully for the same thing, so I'm glad you asked.