[英]Nexgen gallery wordpress not showing images
I have updated the Nexgen gallery plugin and it stop showing the galleries on the page which I am getting by custom PHP code. 我已经更新了Nexgen gallery插件,它停止在通过自定义PHP代码获取的页面上显示图库。
Here is code which I am using for getting gallery. 这是我用来获取图库的代码。
$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
}
?>
I just change post_name with post ID and its start working.. 我只是用post ID更改post_name并开始工作。
$images = $nggdb->get_gallery($post->ID, 'sortorder', 'ASC', true, 0, 0);
so here is correct code.. 所以这里是正确的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.