使用相同的图像在WordPress的画廊没有上传过很多次

问题描述 投票:0回答:1

我知道这听起来很奇怪,但我需要反复的图像画廊。

我需要知道,如果有可能使用相同的图像库中的一个以上的时间,而不必一次又一次地添加它。这是很烦人的具有相同的图像重复多次上传的图片中。

提前致谢。

wordpress image grid gallery
1个回答
0
投票

不,不与原单WordPress的代码。即使手动将几次相同的媒体-ID将导致只有一个图像渲染。你可以,但是,创建你自己的画廊简码:code from here

//Init hook
add_action('init', 'override_gallery');

//Override function
function override_gallery()
{
    remove_shortcode('gallery');
    add_shortcode('gallery', 'my_gallery_shortcode');
}

//Custom gallery shortcode
function my_gallery_shortcode($atts, $content) {

    //Default parameters to 
    extract( shortcode_atts( array(
            'ids' => '',
            'orderby' => 'post__in',
            'columns' => '3',
            'link' => 'file' //file | link | <empty string> (for linking to attachment page)
    ), $atts ));

    //Your own presentational code here...
}

但你还是不能选择相同的图像在图像选择好几倍。但是你可以在你的简码相乘。也许这是最好使用另外一个名字,虽然创建自己的短代码。

© www.soinside.com 2019 - 2024. All rights reserved.