admin管理员组文章数量:1322838
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.
本文标签: Replacing all attachment links in post with media file link
版权声明:本文标题:Replacing all attachment links in post with media file link 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742115081a2421430.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论