簡體   English   中英

Nexgen Gallery Wordpress不顯示圖像

[英]Nexgen gallery wordpress not showing images

我已經更新了Nexgen gallery插件,它停止在通過自定義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
}

?>

我只是用post ID更改post_name並開始工作。

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

所以這里是正確的代碼。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM