Nexgen画廊wordpress没有显示图像

时间:2016-01-14 18:18:39

标签: php jquery wordpress gallery

我已经更新了Nexgen图库插件,它停止在页面上显示我通过自定义PHP代码获取的图库。

以下是我用于获取图库的代码。

$nggdb = new nggdb();
$images = $nggdb->get_gallery($post->post_name, 'sortorder', 'ASC', true, 0, 0);
foreach($images as $i=>$image) {
    // list($originalWidth, $originalHeight) = getimagesize($image->url);
    // $ratio = (float)$originalWidth / $originalHeight;

    // if($ratio > 1.2) {
        // $class = "width-2";
    // } else {
        // $class = "";
    // }

    ?>
    <a class="fancybox" href="<?php echo $image->imageURL; ?>">
        <div class="grid-item col-md-3  col-sm-6 col-xs-12">
            <img src="<?php echo $image->thumbnailURL; ?>" />
            <?php
            if($image->_ngiw->_cache['description'] != "") {
                ?>
                <div class="title">
                    <?php echo $image->_ngiw->_cache['description']; ?>
                </div>
                <?php
            }
            ?>
        </div>
    </a>
    <?php
}

?>

1 个答案:

答案 0 :(得分:0)

我只是使用帖子ID更改post_name并开始工作..

$images = $nggdb->get_gallery($post->ID, 'sortorder', 'ASC', true, 0, 0);

所以这里是正确的代码..