Wordpress一个标签显示缩略图图像在灯箱与插件

时间:2017-05-10 10:04:58

标签: php html wordpress lightbox custom-post-type

所以我尝试制作一个名为' showcase'的自定义帖子类型。并在此自定义帖子类型中创建了一些帖子。问题是,当我点击“产品”时,它应该在灯箱中显示,而不是转到缩略图网址。

这是我正在使用的代码:

unsigned int str_to_mins(const char* t) {
    return (unsigned int) (
        ((t[0] - '0') * 10 + (t[1] - '0')) * 60 
        + (t[3] - '0') *10 + (t[4] - '0')
    );
}

另外,我尝试使用一些自动检测jpg,gif等的插件但由于某些原因它们不适用于缩略图。

我测试过的一些插件:

Easy FancyBox, 自适应灯箱, 简单的灯箱,

此外,我没有收到任何错误,只是直接进入网址中的媒体文件,而不是停留在同一页面上并在灯箱中显示图像。

提前致谢(:

1 个答案:

答案 0 :(得分:0)

您可以使用Fresco-Lightbox。实施后,您可以将" fresco" -class添加到任何imagelink并在灯箱中打开它:

<a class="entry-showcase fresco" href="<?php the_post_thumbnail_url(); ?>" title="<?php the_title_attribute(); ?>">
    <?php the_post_thumbnail( 'medium' ); ?>
</a>

另见Fresco documentation